>

'Date'부분의 레이블 사이에 공백이있는 이유를 모르겠습니다. 레이블이있는 프레임 크기 조정의 문제라고 생각하지만 더 붙어있는 모든 것을 수용 할 수있는 방법이 있어야합니다. 코드 부분에 문제가있는 메시지를 넣었습니다.

모든 것을 시도했다고 생각합니다 ... tkinter를 사용한 것은 이번이 처음입니다. 도와 주셔서 감사합니다

from tkinter import *

# ======================== Window
window = Tk()
window.title("School Management System")
window.geometry("1350x750+0+0")

# ===================== Frames
top_frame = Frame(window, width=1000,height=100, bd=15, relief='raise')
top_frame.pack(side=TOP)
frames_L = Frame(window,  bd=5, width=100, relief='raise')
frames_L.pack(side=LEFT, fill=Y)
frames_R = Frame(window, bd=5, relief='raise')
frames_R.pack(side=RIGHT, fill=Y)

# ================= Labels =========================================
tittle = Label(top_frame, text="Lucille Rupp's School Management System",
                  font=('times new roman', 30, 'bold'), justify='center', width=30).grid(row=0, column=0)
# NAME
name_input = StringVar()
label_name = Label(frames_L, text=' First Name:', font=('arial', 12, 'bold'), justify='center', width=10)
label_name.grid(row=1, sticky=W)
entry_name = Entry(frames_L, font=('arial', 12), justify='left', width=30, relief='sunken', textvariable=name_input)
entry_name.grid(row=1, column=1)
#LAST NAME
lastname_input = StringVar()
label_lastname = Label(frames_L, text=' Last Name:', font=('arial', 12, 'bold'), justify='center', width=10)
label_lastname.grid(row=2, sticky=W)
entry_lastname = Entry(frames_L, font=('arial', 12), justify='left', width=30, relief='sunken', textvariable=lastname_input)
entry_lastname.grid(row=2, column=1)

#DATE ===== HERE IS THE PROBLEM =========
label_date = Label(frames_L, text='Date:', font=('arial', 12, 'bold'), width=10, anchor='w')
label_date.grid(row=3, column=0)
entry_day = Entry(frames_L,  font=('arial', 12, 'bold'),  width=10)
entry_day.grid(row=3, column=1, sticky='w')
entry_month = Entry(frames_L,  font=('arial', 12, 'bold'),  width=10)
entry_month.grid(row=3, column=2)
window.mainloop()

  • 답변 # 1

    두 날짜를 맞추고 이름과 성을 같은 x로 끝내려면 2 개의 열 길이에 해당하는 입력란을 만들어야합니다.

    from Tkinter import *
    
    # ======================== Window
    window = Tk()
    window.title("School Management System")
    window.geometry("1350x750+0+0")
    
    # ===================== Frames
    top_frame = Frame(window, width=1000,height=100, bd=15, relief='raise')
    top_frame.pack(side=TOP)
    frames_L = Frame(window,  bd=5, width=100, relief='raise')
    frames_L.pack(side=LEFT, fill=Y)
    frames_R = Frame(window, bd=5, relief='raise')
    frames_R.pack(side=RIGHT, fill=Y)
    
    # ================= Labels =========================================
    tittle = Label(top_frame, text="Lucille Rupp's School Management System",
                      font=('times new roman', 30, 'bold'), justify='center', width=30).grid(row=0, column=0)
    # NAME
    name_input = StringVar()
    label_name = Label(frames_L, text=' First Name:', font=('arial', 12, 'bold'), justify='center', width=10, anchor='w')
    label_name.grid(row=1, column=0, sticky=W)
    entry_name = Entry(frames_L, font=('arial', 12), justify='left', width=30, relief='sunken', textvariable=name_input)
    entry_name.grid(row=1, column=1, columnspan=2)## Added Column Span
    #LAST NAME
    lastname_input = StringVar()
    label_lastname = Label(frames_L, text=' Last Name:', font=('arial', 12, 'bold'), justify='center', width=10,anchor='w')
    label_lastname.grid(row=2,  column= 0 , sticky=W)
    entry_lastname = Entry(frames_L, font=('arial', 12), justify='left', width=30, relief='sunken', textvariable=lastname_input)
    entry_lastname.grid(row=2, column=1 ,columnspan = 2)## Added Column Span
    
    #DATE ===== HERE IS THE PROBLEM =========
    label_date = Label(frames_L, text=' Date:', font=('arial', 12, 'bold'), justify='center', width=10, anchor='w')
    label_date.grid(row=3, column=0, sticky=W)
    entry_day = Entry(frames_L,  font=('arial', 12, 'bold'),  width=10)
    entry_day.grid(row=3, column=1, sticky=W+E+N+S)
    entry_month = Entry(frames_L,  font=('arial', 12, 'bold'),  width=10)
    entry_month.grid(row=3, column=2, sticky=W+E+N+S)
    window.mainloop()
    
    

    결과 창은 다음과 같습니다-

  • 이전 mongodb - Docker 컨테이너가 자동으로 종료
  • 다음 c# - WPF 달력은 LostFocus에서 선택된 날짜를 선택 해제합니다