简体   繁体   中英

How can I pack tkinter buttons vertically?

How I can put the following buttons in vertical instead of horizontal? because I want to put these buttons in left vertically and picture in right? "in python language"

    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)

Create two frames. Pack one on the left for the buttons, one on the right for everything else. Then, add the buttons to the left frame and pack them with side="top" or side="bottom" .

Don't be afraid to use additional frames to block out your GUI into sections. It's much easier to lay out GUIs doing that, rather than trying to get everything lined up inside a single window using a single geometry manager.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM