http://www.python.org/misc/workshop5-95/guiProgNotes.html
from wpy import * class MyView(CScrollView) def OnCreate(self, event): b = CPushButton(self, "Quit") b.Create() self.button = b def OnSize(self, rect): self.button.WpyPlace(rect, 0.5, 0.5, "center") class MyApp(CWinApp): def InitInstance(self): templ = CSingleDocTemplate(CDocument, CFrameWnd, MyView) templ.wpyText = "Hello World" self.AddDocTemplate(templ) self.FileNew() def OneButtonQuit(self, control): self.Exit() # Start the App, respond to events... app = MyApp()
import Tkgu def printit(): print 'howdy' top = Tkgu.Tkgu() frame1 = top.frame('.', '-relief raised -bd 2') button1 = top.button(frame1) top.tcl(button1,'configure-command', printit, '-text "Hello World"') Tkgu.mainloop()
import rivet def printit(): print 'howdy' top = rivet.init() frame1 = top.frame('-bd', 4, '-relief', 'raised') button1 = frame1.button() rivet.pack(frame1, button1, '-expand', 'yes', '-fill', 'both') rivet.mainloop()