-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGUI.py
75 lines (62 loc) · 2.11 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#import the libraries + other files in the project
import tkinter as tk
from tkinter.ttk import *
from search import *
#UI variables go here
var = "1"
#UI Functions
def Listings():
search = query.get()
label = tk.Label(text = Listing(search), bg = secColour)
label.place(x = 0, y = 100)
def Reviews():
search = query.get()
label = tk.Label(text = Review(search), bg = secColour)
label.place(x = 100, y = 100)
def Suburbs():
search = query.get()
label = tk.Label(text = Suburb(search), bg = secColour)
label.place(x = 0, y = 100)
def Date():
search = query.get()
label = tk.Label(text = Dates(search), bg = secColour)
label.place(x = 200, y = 100)
#I'm drawing this window here, because it doubled up in the other script
options = tk.Tk()
options.resizable(False, False)
options.title("Test")
label = tk.Label(options, text = "Would you like to draw a graph?")
label.pack()
ybut = tk.Button(options, text = "Yes", command = Yes)
ybut.pack()
nbut = tk.Button(options, text = "No", command = No)
nbut.pack()
options.mainloop()
#drawing the GUI
root = tk.Tk()
root.title("GUI")
bgColour = "red"
secColour = "orange"
screenWidth = root.winfo_screenwidth()
screenHeight = root.winfo_screenheight()
width = 1000
height = 400
centerX = int(screenWidth / 2 - width / 2)
centerY = int(screenHeight / 2 - height / 2)
root.geometry(f'{width}x{height}+{centerX}+{centerY}')
root.resizable(False, False)
frame1 = tk.Frame(master = root,height = height, bg = bgColour)
frame1.pack(fill = tk.X)
label = tk.Label(text = "Search:", bg = bgColour)
query = tk.Entry(root)
Lbutton = tk.Button(text = "Search Listings", bg = secColour, command = Listings)
Lbutton.place(x = 230, y = 0)
Rbutton = tk.Button(text = "Search Reviews", bg = secColour, command = Reviews)
Rbutton.place(x = 370, y = 0)
Sbutton = tk.Button(text = "Search Suburbs", bg = secColour, command = Suburbs)
Sbutton.place(x = 510, y = 0)
Dbutton = tk.Button(text = "Search Dates", bg = secColour, command = Date)
Dbutton.place(x = 650, y = 0)
label.place(x = 0, y = 0)
query.place(x = 60, y = 0)
root.mainloop()