Prerequisite – Python – Creating window, button in GTK+ 3
In GTK+ rather than specifying the position and size of each widget in the window, you can arrange your widgets in rows, columns, and/or tables. The size of your window is determined automatically, based on the sizes of the widgets it contains. And the sizes of the widgets are, in turn, determined by the amount of text they contain. Perfecting the layout can be completed by specifying padding distance and centering values of widgets.
GTK+ arranges widgets hierarchically, using containers. There are two types of containers single-child containers and multiple-child containers. The most commonly used are vertical or horizontal boxes
(Gtk.Box) and grids
Follow below steps:
- import GTK+ 3 module.
- Create main window.
- Create Box.
- Create Button.
Note: In IDE’s like Pycharm we can install a package named PyGObject in order to use GTK+ 3.
Boxes are invisible containers into which we can pack our widgets. When packing widgets into a horizontal box, the objects are inserted horizontally
Gtk.Box.pack_start() (left to right ) or
Gtk.Box.pack_end() (right to left). In a vertical box, widgets are packed from top to bottom or vice versa.
On clicking this we get.
- Create a directory in Python
- How to create a Dictionary in Python
- Create Certificates using Python-PIL
- Create a stopwatch using python
- Create XML Documents using Python
- How to create a new thread in Python
- Python Program to Create a Lap Timer
- Create simple Blockchain using Python
- Python: MySQL Create Table
- Create Air Canvas using Python-OpenCV
- Python | Create checkbox using .kv file
- How to create an empty class in Python?
- Create and Import modules in Python
- Create an empty file using Python
- Create First GUI Application using Python-Tkinter
- Create a Weather app using Flask | Python
- Python - Create() function in wxPython
- Create Classes Dynamically in Python
- Python - Create window button in GTK+ 3
- How to Create a Programming Language using Python?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.