PyGTK Hello World - PyGTK

What is PyGTK Hello World?

Creating a window using PyGTK is very easy. To continue, we first need to import the gtk module in our code.

The gtk module comprises the gtk.Window class. Its object constructs a toplevel window. We derive a class from gtk.Window.

Define the constructor and call the show_all() method of the gtk.window class.

We currently have to declare the object of this class and start an event loop by calling its main() method.

It is suggested we add a label “Hello World” in the parent window.

The resulting is a complete code to display “Hello World”−

The execution of the above code will yield the resulting output –

hello_world_pygtk

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

PyGTK Topics