#1
  1. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407

    Tkinter( button )


    For some reason my button wont go at the end of the program it keeps showing up on the right side of the listbox any idea?

    Code:
    from Tkinter import *
    import os
    
    class GUI:
    
          def __init__(self, master, dir_path):
    
              frame = Frame(master)
              frame.pack()
    
              self.label2 = Label(frame, text="Files in your current Directory", background="blue",foreground="white")
              self.label2.pack(fill=BOTH, expand=1)
    
              self.scrollbar = Scrollbar(frame, orient=VERTICAL)
              self.list = Listbox(frame, yscrollcommand=self.scrollbar.set, background="black", foreground="white")
    
              self.scrollbar.config(command=self.list.yview)
              self.scrollbar.pack(side=RIGHT, fill=Y)
    
    
              for i in range(0,len(dir_path)):
    
                  self.list.insert(END, str(dir_path[i]))
                  self.list.pack(side=LEFT, fill=BOTH, expand=1)
                  
              self.Creat_buttons(frame)
    
          def Creat_buttons(self,root):
    
              self.button = Button(root, text="Quit", command=root.quit)
              self.button.pack(side=RIGHT, expand=1)
    
    
    
    root = Tk( )
    dir_data = os.listdir(os.curdir)
    send_var = GUI(root, dir_data)
    root.mainloop( )
  2. #2
  3. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407
    nm
  4. #3
  5. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    Perhaps
    self.button.pack(side=RIGHT, expand=1)
    is a clue ?


    Grim
  6. #4
  7. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    Code:
          def Creat_buttons(self, root): 
    
              self.button = Button(root, text = "Quit", command = root.quit)
              self.button.pack(side = RIGHT, expand = 1)
    self.button.pack(side = RIGHT, expand = 1)
  8. #5
  9. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407
    ya it was that.. i have another question though.. in tkinter.. i visited a site that has some of the example etc but im still confused on how to use some function is there another site that shows you an example on each function?
  10. #6
  11. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    My favourites:
    Fredrik Lundh's documentation. There is a PDF version that I use. It is not complete but has detail.

    This is widget collection that builds on Tkinter and has good documentation:PMW Python Mega Widgets

    I hope this helps some.
    Grim

IMN logo majestic logo threadwatch logo seochat tools logo