2015-07-02 51 views
0

如何將下列按鈕設置爲垂直而不是水平?因爲我想把這些按鈕放在垂直的左邊,並且圖片在右邊? 「in python language」如何垂直包裝tkinter按鈕?

self.myParent = parent 
    self.myContainer1 = Frame(parent) 
    self.myContainer1.pack() 

    self.button1 = Button(self.myContainer1, command=self.button1Click) 
    self.button1.configure(text="Generate The Fraud Detection File", background= "grey") 
    self.button1.pack(side=LEFT) 
    self.button1.focus_force()   


    self.button3 = Button(self.myContainer1, command=self.button2Click) 
    self.button3.configure(text="  Cancel  ", background="grey")  
    self.button3.pack(side=RIGHT) 


    self.button3 = Button(self.myContainer1, command=self.button2Click) 
    self.button3.configure(text="  Edit  ", background="grey")  



    self.button2 = Button(self.myContainer1, command=self.button3Click) 
    self.button2.configure(text="Disply The File of Fraud Detection", background="grey")  
    self.button2.pack(side=RIGHT) 

    self.button4 = Button(self.myContainer1, command=self.button4Click) 
    self.button4.configure(text="Display The Monthly Chart", background="grey")  
    self.button4.pack(side=RIGHT) 
+0

你使用的是什麼GUI框架? – jordanm

+0

對於你所有的按鈕(可能是第一個按鈕的頂部),怎麼迴避(side = BOTTOM)? –

回答

2

創建兩個幀。在左側裝一個按鈕,其餘的一個裝在右側。然後,將按鈕添加到左側框架,並將它們打包爲side="top"side="bottom"

不要害怕使用額外的框架來將您的GUI分成多個部分。佈置圖形用戶界面更容易,而不是試圖使用單個幾何圖形管理器將所有內容排列在一個窗口內。