Thread: grid() fuction

    #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

    grid() fuction


    Ok this is weird.. why is it that when i used the pack() fuction my program was working proberly.. but once i changed a few things to .grid() the program does not want to run.. it just halts anyidea why?

    Code:
    class GUI:
    
          def __init__ (self, master):
    
              frame = Frame (master, bd=1, relief=SUNKEN)
              frame.pack (expand=YES, fill=BOTH)
    
              master.title (" Learning Program ")
    
              self.label = Label (frame, text="Message:", fg="blue").grid (row=0, sticky=W)
    
              self.entry = Entry (frame, border=1)
              self.entry.grid (row=0, column=1)
    
              self.buttonQuit = Button(frame, text="Quit", background="white",
                                       font="helvetica 7 bold",
                                       pady=1, padx=1, bitmap="error", command=frame.quit)
              self.buttonQuit.pack (side=RIGHT, fill=BOTH, expand=YES)
    
    
              self.button = Button (frame, text="Connect",
                                    background="white",
                                    font="helvetica 7 bold",
                                    pady=1, padx=1, border=2)
    
              self.button.pack (side=RIGHT, fill=BOTH, expand=YES)
              self.button.bind("<Button-1>", self.change_color)
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    The root of your problem - you can't use pack() and grid() together. So unfortuatly its one or the other although grid() seems to give you more controle over layout in general.

    Mak.
    programming language development: www.netytan.com Hula

  4. #3
  5. 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
    Originally Posted by netytan
    The root of your problem - you can't use pack() and grid() together. So unfortuatly its one or the other although grid() seems to give you more controle over layout in general.

    Mak.
    oh hehe i didnt know that thanx is there anything there.. that i should shange or am i on the right track
  6. #4
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    From what i can see its looking fine, just get choose between pack() and grid() - wouldn't quote me on this though, not really a GUI guru and Tkinter makes me sick

    Mark.
    programming language development: www.netytan.com Hula

  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 sorry i didnt mean to quote you.. im sick and im tring to learn python at once... for a moment i feel like going to bed but then again i feel like playing around sux when its like that, btw.. why does Tkinter make you sick? got anything better? your making me feel like if im waisting my time learning Tkinter
  10. #6
  11. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Awwwe, you tuck that totaly the wrong way lord. Sorry your feeling down! Anyway i wouldnt say learning Tk is a waste of time it just looks icky and to be honest seems out of date. So if i had to pick a GUI i'd have to go with wxPython.

    dont quote me on that = i might be wrong

    Hope this clears things up.

    Mark.
    programming language development: www.netytan.com Hula

  12. #7
  13. 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
    hehehe i will take a look on wxpython even though i never heard o it.. but i guess now i did hehe but for some stupid reason.. after coding in c/php for a while.. i understand python a bit more heh weird as they are not the same... although if you put 2 and 2 together they are all the same

IMN logo majestic logo threadwatch logo seochat tools logo