2015-07-02 49 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分成多个部分。布置图形用户界面更容易,而不是试图使用单个几何图形管理器将所有内容排列在一个窗口内。