Python: simple tkinter script added
This commit is contained in:
Executable
+27
@@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if sys.version_info >= (3,6):
|
||||||
|
from tkinter import *
|
||||||
|
else:
|
||||||
|
from Tkinter import *
|
||||||
|
|
||||||
|
class App:
|
||||||
|
def __init__(self, master):
|
||||||
|
frame = Frame(master)
|
||||||
|
frame.pack()
|
||||||
|
self.button = Button(frame,
|
||||||
|
text="QUIT",
|
||||||
|
command=frame.quit)
|
||||||
|
self.button.pack(side=LEFT)
|
||||||
|
self.slogan = Button(frame,
|
||||||
|
text="Hello",
|
||||||
|
command=self.write_slogan)
|
||||||
|
self.slogan.pack(side=LEFT)
|
||||||
|
def write_slogan(self):
|
||||||
|
print ("Tkinter is easy to use!")
|
||||||
|
|
||||||
|
root = Tk()
|
||||||
|
app = App(root)
|
||||||
|
root.mainloop()
|
||||||
Reference in New Issue
Block a user