-
Notifications
You must be signed in to change notification settings - Fork 1
/
gui.py
executable file
·49 lines (38 loc) · 1.25 KB
/
gui.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
# encoding: utf-8
"""
gui.py
A simple GUI that can display colors
"""
import Tkinter as tk
import sys
# from main import searchEvent
searchText = "hello"
class Gui(tk.Frame):
def __init__(self, quitCallback, get_string, master=None):
tk.Frame.__init__(self, master)
self.master.title('Much Twitter')
self.quitCallback = quitCallback
self.get_string = get_string
self.color = 'white'
#TODO do we need grid? self.grid(column=0, row=0, ipadx=100, ipady=100, sticky=('N','W','E','S'))
self.configure(background=self.color)
self.grid_rowconfigure(0, weight=1)
self.grid_columnconfigure(0, weight=1)
self.pack(fill="both", expand=True, ipadx=100, ipady=100)
self.createWidgets()
def stopGui(self):
self.destroy()
sys.exit(0)
def createWidgets(self):
#TODO text box for search query text
self.search = tk.Entry(self)
self.search.grid()
b = self.quitButton = tk.Button(self, text='Quit', command=self.quitCallback)
self.quitButton.grid()
def setColor(self, color):
self.color = color
self.configure(background=self.color)
""" Example execution """
#app = Gui()
#app.mainloop()