我有這個代碼,但這只是系統非常長的代碼的一部分。問題是,我試圖創建一個標題邊框,但沒有出現。我不知道什麼是錯誤。標題邊界Tkinter - 沒有出現
from Tkinter import *
def onclick():
pass
import tkMessageBox
root = Tk()
root.title("Pantai Hospital")
root.geometry("200x200")
Label(root, text = "Welcome to Pantai Hospital!").grid()
#the problem starts here
f1 = Frame(root, width = 300, height = 110)
f2 = Frame(f1, relief = GROOVE, borderwidth = 2)
l9 = Label(f2, text = "Choose your specialist:")
l9.pack(pady = 10)
specialistchoose = IntVar()
r1 = Radiobutton (f2, text = "Cardiology", variable = specialistchoose, value = 1)
r1.grid(row = 1, column = 0)
r2 = Radiobutton (f2, text = "Gastroenterology", variable = specialistchoose, value = 2)
r2.grid(row = 1, column = 1)
r3 = Radiobutton (f2, text = "Dermatology", variable = specialistchoose, value = 3)
r3.grid (row = 1, column = 2)
r4 = Radiobutton (f2, text = "Psychiatry", variable = specialistchoose, value = 4)
r4.grid (row = 3, column = 0)
r5 = Radiobutton (f2, text = "Dentist", variable = specialistchoose, value = 5)
r5.grid(row = 3, column = 1)
f2.place(relx = 0.01, rely = 0.125, anchor = NW)
Label(f1, text = "Specialist:").place(relx = .06, rely = 0.125, anchor = W)
f1.pack()
root.mainloop()
沒有人有任何想法如何克服這個?謝謝:)
您可以創建一個期望的結果圖像? – furas
我運行您的代碼,並收到錯誤消息。下次在console/terminal/cmd.exe中檢查您的代碼並添加完整的錯誤消息。 – furas