1
我想獲得下面的Tkinker圖像。我只需要將標籤設置到所需的位置。無法將多個標籤設置到左側,我該怎麼做?
這是我想要的方向。 我不能複製這個,因爲框架不會允許多個東西設置爲同一側,左或右。
這裏是我以前寫這個GUI的源代碼:
master = Tk.Tk()
master.title('Program Application')
Folder(10)
print "VSM activated input range first"
################### Declare button and respective method ###################
button = Tk.Button(text='VSM', command=VSM, fg="red")
button.config(height = 8, width = 80)
button.pack() #pack is needed to display the button
bluebutton = Tk.Button(text="AGM Folder",command= lambda: Folder(0), fg="blue").pack(side = LEFT)
bluebutton = Tk.Button(text="VSM Folder",command= lambda: Folder(1), fg="blue").pack(side = RIGHT)
Label(text='Correct Range for Gradient\nOP X2 X1\nIP X2 X1').pack(side=TOP,padx=10,pady=10)
################### Use 3 frames to contains entries, buttons ###################
frameX2 = Frame(master)
frameX2.pack(side=LEFT, expand=1, anchor=E)
entryX2 = Entry(frameX2, width=10)
entryX2.pack(side=TOP,padx=10,pady=10)
entryX2IP = Entry(frameX2, width=10)
entryX2IP.pack(side=TOP,padx=10,pady=10)
frameButton = Frame(master)
frameButton.pack(side=LEFT)
Tk.Button(frameButton, text='Input Range',command= lambda: Folder(2), fg="red").pack(padx=10, pady=10)
frameX1 = Frame(master)
frameX1.pack(side=LEFT, expand=1, anchor=W)
entryX1 = Entry(frameX1,width=10)
entryX1.pack(side=TOP,padx=10,pady=10)
entryX1IP = Entry(frameX1,width=10)
entryX1IP.pack(side=TOP,padx=10,pady=10)
######### Loop ############
master.mainloop() # Continue loop till user close tab
print "End of Program"
entryX1.pack(side=TOP,padx=10,pady=10)
entryX1IP = Entry(frameX1,width=10)
entryX1IP.pack(side=TOP,padx=10,pady=10)
######### Loop ############
master.mainloop() # Continue loop till user close tab
這是非常好,長得這麼整潔。 – user2837162