Skip to content

Commit b67f35a

Browse files
Some
1 parent d26b21f commit b67f35a

3 files changed

Lines changed: 55 additions & 0 deletions

File tree

GUI/Files/memo.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello: a

GUI/gui.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import tkinter as tk
2+
3+
class Application(tk.Frame):
4+
def __init__(self, master=None):
5+
super().__init__(master)
6+
self.pack()
7+
self.create_widgets()
8+
9+
def create_widgets(self):
10+
self.hi_there = tk.Button(self)
11+
self.hi_there["text"] = "Hello World\n(click me)"
12+
self.hi_there["command"] = self.say_hi
13+
self.hi_there.pack(side="top")
14+
15+
self.quit = tk.Button(self, text="QUIT", fg="red",
16+
command=root.destroy)
17+
self.quit.pack(side="bottom")
18+
19+
def say_hi(self):
20+
print("hi there, everyone!")
21+
22+
root = tk.Tk()
23+
app = Application(master=root)
24+
app.mainloop()

GUI/tk.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from Tkinter import *
2+
3+
4+
class App:
5+
6+
def __init__(self, master):
7+
frame = Frame(root, width=450, height=250)
8+
frame.pack()
9+
self.quote = Label(frame, text="hel", height=10, width=30, wraplength=300,
10+
bg="#fff", padx=10, fg="#333", font=("Helvetica", 14))
11+
self.quote.pack()
12+
self.author = Label(frame, text="-" + "author", anchor="e",
13+
justify='right', padx=20, pady=15, bg="#fff", fg="#444", font=("Helvetica", 12))
14+
self.author.pack(side="right")
15+
self.button = Button(frame, text="QUIT", fg="red", justify="left")
16+
self.button.bind("<Button-1>", self.callback)
17+
self.button.pack()
18+
self.hi_there = Button(frame, text="Hello",
19+
command=self.say_hi, justify="left")
20+
self.hi_there.pack()
21+
22+
def say_hi(self):
23+
print "hi there, everyone!"
24+
25+
def callback(self, event):
26+
print "clicked at", event.x, event.y
27+
root = Tk()
28+
root.configure(background='#fff')
29+
app = App(root)
30+
root.mainloop()

0 commit comments

Comments
 (0)