Obra: Python/Programação com GUI
tkinter ver artigo principal python tkinter baseada em tcl tk tkinter interface padrão do python from tkinter import python class app def self master frame frame master frame pack self button button frame text quit fg red command master destroy self button pack side left self hi_there button frame text oi command self say_hi self hi_there pack side left def say_hi self print ola mundo root tk app app root root mainloop wxpython wxpython um wrapper da biblioteca wxwindows from wx import id_about id_exit class myframe wx frame def self parent id title wx frame self parent id title wx defaultposition wx size self createstatusbar self setstatustext this is the statusbar menu wx menu menu append id_about about more information about this program menu appendseparator menu append id_exit xit terminate the program menubar wx menubar menubar append menu file self setmenubar menubar class myapp wx app def oninit self frame myframe none hello from wx python frame show true self settopwindow frame return true app myapp app mainloop pygtk pygtk um wrapper para python criado por james henstridge construído sobre gimp toolkit gtk biblioteca usada pelo gnome muitas outras aplicações para linux import gtk class helloworld gtk window def self gtk window self self connect delete_event gtk main_quit self self set_title hello world hbox gtk hbox self add hbox self button gtk button button self button connect clicked self hbox pack_start self button self button gtk button button self button connect clicked self hbox pack_start self button def self button print hello again was pressed button get_label if win helloworld win show_all gtk main pyqt pyqt um wrapper da linguagem python para biblioteca qt que base do kde ambiente desktop para sistemas operacionais parecidos com unix como linux por exemplo primeiro programa tradicional hello world ou alô mundo mostra facilidade de escrever na versão do qt usr bin env python import sys from pyqt import qt we instantiate qapplication passing the arguments of the script to it qt qapplication sys argv add basic widget to this application the first argument is the text we want this qwidget to show the second one is the parent widget since our hello is the only thing we use the so called mainwidget it does not have parent hello qt qlabel hello world and that it should be shown hello show now we can start it exec_ esta uma versão um pouco mais complicada do hello world import sys from qt import class hellobutton qpushbutton def self args qpushbutton self args self settext hello world class hellowindow qmainwindow def self args qmainwindow self args self button hellobutton self self self button def main args app qapplication args win hellowindow win show app connect app signal app slot quit app exec_loop if main sys argv pygame pygame uma biblioteca multiplataforma construída sobre sdl permitindo criação de jogos programas multimídia import sys pygame pygame init tam width height vel pet tela pygame display set_mode tam bola pygame i
mport sys pygame pygame init tam width height vel pet tela pygame display set_mode tam bola pygame image load image png bolarc bola get_rect tela fill pet tela blit bola bolarc pygame display flip de python programmierung gui programmierung