Tkinter Python

mail@pastecode.io avatar
unknown
python
2 years ago
2.0 kB
2
Indexable
Never
from tkinter import *
from tkinter import font
from tkinter import messagebox
import random

app = Tk()
app.geometry("700x700")
app.title("Restaurant System")

home = Frame(app)
menu = Frame(app)
booking = Frame(app)
contact = Frame(app)

# Fonts needed for application
font1 = font.Font(family='Georgia', size='22', weight='bold')
font2 = font.Font(family='Georgia', size='12', weight='bold')

def change_to_home():
    home.pack(fill='both', expand=1)
    menu.pack_forget()
    booking.pack_forget()
    contact.pack_forget()

def change_to_menu():
    menu.pack(fill='both', expand=1)
    home.pack_forget()
    booking.pack_forget()
    contact.pack_forget()

def change_to_booking():
    booking.pack(fill='both', expand=1)
    home.pack_forget()
    menu.pack_forget()
    contact.pack_forget()

def change_to_contact():
    contact.pack(fill='both', expand=1)
    home.pack_forget()
    menu.pack_forget()
    booking.pack_forget()

home_btn = Button(app, text="Home", font=font2, command=change_to_home).place(x=190, y=0)
booking_btn = Button(app, text="Booking", font=font2, command=change_to_booking).place(x=255, y=0)
menu_btn = Button(app, text="Menu", font=font2, command=change_to_menu).place(x=339, y=0)
contact_btn = Button(app, text="Contact", font=font2, command=change_to_contact).place(x=402, y=0)

home_label = Label(home, text="Home", foreground="black", font=font1).place(x=310, y=40)
bg = PhotoImage(file="C:/Users/44785/Pictures/background (3).png")
home_background = Label(home, image=bg)
home_background.place(x=0, y=0)

booking_label = Label(booking, text="Booking", foreground="black", font=font1).place(x=300, y=40)
menu_label = Label(menu, text="Menu", foreground="black", font=font1).place(x=310, y=40)
contact_label = Label(contact, text="Contact", foreground="black", font=font1).place(x=305, y=40)
contact_label2 = Label(contact, text="Ct", foreground="black", font=font2).place(x=300, y=100)

app.mainloop()