[[tki2]]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tki2 [2014/10/26 01:52] (current)
Line 1: Line 1:
 +==== Tk example ====
 +<​code>​
 +from Tkinter import *
 +
 +class App:
 +
 +    def __init__(self,​ master):
 +
 +        frame = Frame(master)
 +        frame.pack()
 +
 +        self.button = Button(
 +            frame, text="​QUIT",​ fg="​red",​ command=frame.quit
 +            )
 +        self.button.pack(side=LEFT)
 +
 +        self.hi_there = Button(frame,​ text="​Hello",​ command=self.say_hi)
 +        self.hi_there.pack(side=LEFT)
 +
 +    def say_hi(self):​
 +        print "hi there, everyone!"​
 +
 +root = Tk()
 +
 +app = App(root)
 +
 +root.mainloop()
 +</​code>​
 +
 +----
 +  * [[pythoninfo|Back to Python]]
  
tki2.txt ยท Last modified: 2014/10/26 01:52 (external edit)
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0