পৃষ্ঠাসমূহ

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 - Containers

PyGTK library provides different container classes to control the placement of widgets inside a window. The easiest way is to use a fixed container class and place a widget inside it by specifying its absolute coordinates measured in pixels.
Let us now follow these steps −

Step 1 − Declare an object of the fixed class
fixed = gtk.Fixed()
Step 2 − Create a button widget and add it to the fixed container by using put() method which needs x and y coordinates. Here, the button will be placed at (100,100) position.
btn = gtk.Button("Hello")
fixed.put(btn, 100,100)
Step 3 − You can place multiple controls in the fixed container. And, add it to the top-level window and invoke the show_all() method
self.add(fixed)
self.show_all()
This Absolute Layout, however, is not suitable because of the following reasons −
  • The position of the widget does not change even if the window is resized.
  • The appearance may not be uniform on different display devices with different resolutions.
  • Modification in the layout is difficult as it may need redesigning of the entire form.
The following is the original window
Hello World The following is the resized window
PyGTK Hello World The position of the button is unchanged here.
PyGTK API provides container classes for enhanced management of positioning of widgets inside the container. The advantages of Layout managers over absolute positioning are −
  • Widgets inside the window are automatically resized.
  • Ensures uniform appearance on display devices with different resolutions.
  • Adding or removing widget dynamically is possible without having to redesign.
gtk.Container acts as the base class for the following classes −
  • gtk.ButtonBox
  • gtk.Box
  • gtk.Alignment
  • gtk.EventBox
  • gtk.Table

No comments:

Post a Comment