gui using python pygtk and glade
play

GUI Using Python PyGTK and Glade A. Jai Sathish Kumar - PowerPoint PPT Presentation

Pycon India 2009,IISc GUI Using Python PyGTK and Glade A. Jai Sathish Kumar S.Rajeswari sathishavadi@gmail.com sraji.me@gmail.com PyFLTK Pygame Pyglet PythonCard PyGTK PySide PyQt


  1. Pycon India 2009,IISc GUI Using Python – PyGTK and Glade A. Jai Sathish Kumar S.Rajeswari sathishavadi@gmail.com sraji.me@gmail.com

  2. PyFLTK Pygame Pyglet PythonCard PyGTK PySide PyQt TkInter wxPython

  3. No Standard GUI Tool available

  4. There are some factors that decides the GUI tool

  5. Money

  6. OR Windows User Linux User

  7. Linux and Windows User

  8. A GNOME User

  9. A KDE User

  10. What is PyGTK ?

  11. +

  12. Y PyGTK

  13. Easy to create your own GUI

  14. PyGTK is Free Open Source Software

  15. PyGTK supports Multiplatform Applications

  16. What is GTK ?

  17. GTK (GIMP ToolKit)

  18. Library for creating Graphical User Interfaces

  19. PyGTK Programming Basics

  20. Import required Libraries

  21. Create a Window

  22. Pack Widgets into it

  23. Set Appropriate Signals to Widgets

  24. Connect Signals to Callback Functions

  25. Uses main loop to start GTK+ event processing loop

  26. Putting it all together import pygtk pygtk.require('2.0') import gtk #import libraries class WelcomeMsg: def __init__(self): window = gtk.Window() #create a window window.set_title("Welcome") window.set_border_width(10) window.set_size_request(200,100) window.connect("destroy", self.quit) vbox = gtk.VBox() window.add(vbox) button = gtk.Button("Press Me !") button.connect("clicked",self.printMessage,"Welcome To Pycon India 2009,IISc") vbox.pack_start(button,True,True,0) #pack widgets

  27. button = gtk.Button("Close") button.connect("clicked",self.quit) #connect signals to callback vbox.pack_start(button,True,True,5) window.show_all() def printMessage(self,widget,data): #callback function print data def quit(self,widget): #callback function gtk.main_quit() def main(self): gtk.main() #main loop if __name__ == "__main__": p = WelcomeMsg() p.main()

  28. Run in the terminal python filename.py

  29. END of PyGTK

  30. WELCOME To GLADE

  31. GLADE

  32. What is Glade ?

  33. A User Interface Designer

  34. G L A D E

  35. Rapid Application Development Tool

  36. Used in Many Programming Languages

  37. User Interfaces are stored in XML format

  38. GLADE GUI Designing

  39. A Drag & Drop Interface

  40. Design starts by adding i. Top Levels ii. Containers iii. Controls and Displays

  41. Top Levels

  42. Containers

  43. Controls and Displays

  44. Set the glade file def __init__(self): self.gladefile = "glade file name" self.wTree = gtk.glade.XML(self.gladefile)

  45. Create a dictionary and Connect it dic = { "on_mainWindow_destroy" : gtk.main_quit, } self.wTree.signal_autoconnect(dic)

  46. Resources

  47. http://wiki.python.org/moin/GuiProgramming

  48. http://www.pygtk.org/

  49. http://glade.gnome.org/

  50. ● Mailing list ● IRC ● Forums

  51. We thank and for pictures

Recommend


More recommend