পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Thursday, March 30, 2017

PyGTK - Font Selection Dialog

The gtk.FontSelection widget allows users to select and apply the font of a particular name, size and style. The dialog has a preview box containing some text which will be displayed in selected font description, and two buttons CANCEL and OK.

PyGTK API contains a Pango module which defines classes and functionality required to render high quality internationalized text. Font and text handling in gtk is supported by Pango. The pango.Font object represents a font in a system independent way. The pango.FontDescription object contains the characteristics of a font.
gtk.FontSelectionDialog returns a pango.Font object. In order to apply the selected font, fontmetrics is fetched by obtaining the pango.FontDescription object from it.
The following is a constructor of the FontSelectionDialog class −
dlg = gtk.FontSelectionDialog(title)
The following are some frequently used methods of this class −
  • get_font_name() − This returns a string containing the currently selected font name or None if no font name is selected.
  • set_font_name() − This sets the current font
  • set_preview_text() − This sets the text in the preview area entry
The selected font is applied to the text in a widget using the modify_font() method.
When FontSelectionDialog menu item is activated, the following callback function is invoked −
def on_abtdlg(self, widget):
   about = gtk.AboutDialog()
   about.set_program_name("PyGTK Dialog")
   about.set_version("0.1")
   about.set_authors("M.V.Lathkar")
   about.set_copyright("(c) TutorialsPoint")
   about.set_comments("About Dialog example")
   about.set_website("http://www.tutorialspoint.com")
   about.run()
   about.destroy()
The selected font is applied to the text of label placed on the toplevel window.
Select Font The following is the output −
Font Dialog Boxes

No comments:

Post a Comment