1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#!/usr/bin/env python
"""Simple Tk example to manually test event loop integration.
To run this:
1) Enable the PyDev GUI event loop integration for tk
2) do an execfile on this script
3) ensure you have a working GUI simultaneously with an
interactive console
"""
if __name__ == "__main__":
try:
from Tkinter import *
except:
# Python 3
from tkinter import *
class MyApp:
def __init__(self, root):
frame = Frame(root)
frame.pack()
self.button = Button(frame, text="Hello", command=self.hello_world)
self.button.pack(side=LEFT)
def hello_world(self):
print("Hello World!")
root = Tk()
app = MyApp(root)
|