-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHome_screen.py
69 lines (53 loc) · 2.29 KB
/
Home_screen.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
import tkinter as tk
from tkinter import *
from tkinter.ttk import *
from PIL import ImageTk, Image
from tkinter import messagebox
def home():
def exit_and_open_singleplayer():
win.destroy()
from Singleplayer import open_singleplayer
open_singleplayer()
win = tk.Tk()
win.title("Quicket")
win.resizable(False, False)
win.configure(background='light grey')
p1 = tk.PhotoImage(file=r'images\home\quicket.png')
win.iconphoto(True, p1)
def center_window(window, width, height):
# Get screen width and height
screen_width = window.winfo_screenwidth()
screen_height = window.winfo_screenheight()
# Calculate x and y coordinates to center the window
x = (screen_width // 2) - (width // 2)
y = (screen_height // 2) - (height // 2)
# Set window size and position
window.geometry(f"{width}x{height}+{x}+{y}")
window_width = 470
window_height = 750
center_window(win, window_width, window_height)
win.grid_columnconfigure(0, weight=1)
win.grid_columnconfigure(1, weight=1)
win.grid_columnconfigure(2, weight=1)
win.grid_rowconfigure(0, weight=1)
win.grid_rowconfigure(1, weight=1)
win.grid_rowconfigure(2, weight=1)
win.grid_rowconfigure(3, weight=1)
win.grid_rowconfigure(4, weight=1)
heading = Label(win, text="Quicket", background='light grey', font=('Times New Roman', 50, 'bold'))
heading.grid(row=0, column=1)
quicket_image = Image.open(r'images\home\quicket_bg.png')
quicket_image_resized = quicket_image.resize((250,250))
quicket_resized = ImageTk.PhotoImage(quicket_image_resized)
quicket_image_label = Label(win, image=quicket_resized)
quicket_image_label.grid(row=1, column=1)
play_mode = Label(win, text='-Choose Game Mode-', background='light grey', font=('Century Gothic', 30, 'underline'))
play_mode.grid(row=2, column=1)
photo1 = tk.PhotoImage(file=r'images\home\singleplayer.png')
btn1 = Button(win, image=photo1, style='A.TButton', command=exit_and_open_singleplayer)
btn1.grid(row=3, column=1)
photo2 = tk.PhotoImage(file=r'images\home\multiplayer.png')
btn2 = Button(win, image=photo2, style='B.TButton', command=None)
btn2.grid(row=4, column=1)
win.mainloop()
home()