1
코딩에 관해서는 꽤 초보자입니다. 파이썬과 tkinter GUI를 사용하여 예약 시스템을 코딩했습니다. 결국 데이터베이스를 통합해야하지만 GUI를 먼저 설정하려고합니다. 내 코드는 좀 지저분하지만 잠시 걱정할 필요는 없습니다. 프레임의 앞쪽에있는 단추를 얻으려고 시도하고 있지만이 방법을 막는 방법은 무엇입니까?프레임 뒤의 버튼
내가
대체 :def home_button():
home_title = Button(book, text='HOME', background='#DEEBF7', activebackground='#DEEBF7', width=15, border=0, font = ("Helvetica 15 italic"))
home_title.place(x=423, y=81)
def bookings_button():
bookings_title = Label(book, text='BOOKINGS', background='#DEEBF7', font = ("Helvetica 15 italic"))
bookings_title.place(x=475, y=85)
new_booking = Button(book, text='NEW BOOKING', width=20, height=2, background='#87B7E2')
new_booking.place(x=160, y=170)
def students_button():
students_title = Label(book, text='STUDENTS', background='#DEEBF7', font = ("Helvetica 15 italic"))
students_title.place(x=475, y=85)
## GUI ####
from tkinter import *
root = Tk()
#create the root window
book = Frame(root)
book.grid()
root.title("Home")
root.geometry("850x550")
root.configure(background='#DEEBF7')
backg = Button(book, height=850, width=550, background='#DEEBF7',
activebackground='#DEEBF7', border=0)
backg.pack()
#modify the windows size, colour and the size of the grid
logo1 = Button(book, width=175, height=117, border=0, background='#DEEBF7', activebackground='#DEEBF7', command=home_button)
logo = PhotoImage(file='Logo1.gif')
logo1.image = logo
logo1.configure(image=logo)
logo1.place(x=50, y=20)
title = Label(book, text = "GRAHAM'S SCHOOL OF MOTORING", background = '#DEEBF7', font = ("Helvetica 24 bold"))
title.place(x=250, y=40)
frame=Frame(root, width=551, height=384, background='#000000')
frame.place(x=250, y=135)
frame=Frame(root, width=547, height=380, background='#DEEBF7', borderwidth=5)
frame.place(x=252, y=137)
home = Button(book, text = "HOME", height=2, width=20, background='#5F85CD',
borderwidth=5, activebackground='#A2C7E8', relief='raised', command=home_button)
home.place(x=60, y=150)
bookings = Button(book, text="BOOKINGS", height=2, width=20, background='#5F85CD', borderwidth=5, activebackground='#A2C7E8', relief='raised', command=bookings_button)
bookings.place(x=60, y=235)
student = Button(book, text="STUDENTS", height=2, width=20, background='#5F85CD',
borderwidth=5, activebackground='#A2C7E8', relief='raised', command=students_button)
student.place(x=60, y=320)
back = Button(book, text="BACK", height=2, width=20, background='#FF5559',
borderwidth=5, activebackground='#BF230A', relief='raised')
back.place(x=45, y=450)
root.mainloop()
#kick off the window's event-loop
[python-course.eu Tkinter tutorial] (http://www.python-course.eu/tkinter_layout_management.php)에서 언급했듯이'pack','grid','place'를 섞어서는 안됩니다. 동일한 마스터 창에있는 지오메트리 관리자 –
어떤 버튼입니까? 어떤 프레임? –
@ PM2Ring : 전문 용어에주의하십시오. 동일한 창 (창에 여러 개의 프레임이 있다고 가정)을 동일한 위젯에 없어도 결합 할 수 있습니다. –