#1
  1. CAUTION: Loderator Moose
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Nov 2004
    Location
    some starry place (india)
    Posts
    3,431
    Rep Power
    162

    Question my code wont work.. help !


    hello..
    i'm new to python programming and the Tkinter module of python. I tried to write a program that would allow me to do simple transform stuff to a figure as part of a course in elementary computer graphics.
    The problem is i cant seem to get any output.. just a blank tk frame.
    I've attached my code. any assistance would be greatly appreciated.
    I'm using IDLE 1.0.2 with python version 2.3.3 and Tk 8.4 on an XP pro system.

    thanks in advance..
    Attached Files
    Nigel
    ..Seeking code free nirvana...
    Nigel Fernandes Blog
    Never argue with fools. They will bring you down to their level and beat you with experience.


    Manchester United Forever
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    394
    Rep Power
    51
    Hi!

    There is so much wrong with your code, I don't know where to begin :-)
    1) __init__ is written with 2 "_"
    2) the last lines in your code should look like this
    Code:
    root = Tk()
    a = TFrame(root)
    a.pack()
    root.mainloop()
    As you see the Frame is packed here, so you don't need self.pack() in __init__
    3) There are some typos (self.TransformationPanel <-> self.transformationPanel)
    4)
    Code:
     def putDefaultEntryValues( self, tx = TX_DEFAULT, ty = TY_DEFAULT, angle = ANGLE_DEFAULT, sy = SY_DEFAULT,
    
                                   sx = SX_DEFAULT):
    
            self.tx.delete(0, END)
    There is no self.tx yet. You have to write self.tx = tx first.

    Ok, these are only some points I found. I don't know if I could really help. Maybe it would be better if you started with some smaller and easier scripts to get familiar with the language first

    Regards, mawe

    Comments on this post

    • oneMSBi agrees : thanks
  4. #3
  5. CAUTION: Loderator Moose
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Nov 2004
    Location
    some starry place (india)
    Posts
    3,431
    Rep Power
    162
    gosh.. ! perhaps i should start smaller.. but i need to be able to code programs like the one i tried above.. and time is crucial. thanks so much for the assistance. please pleasse let me know if you find any more blunders ! i ought to have checked the typo's first ! thanks once again.
    Nigel
    ..Seeking code free nirvana...
    Nigel Fernandes Blog
    Never argue with fools. They will bring you down to their level and beat you with experience.


    Manchester United Forever
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2004
    Location
    Albuquerque, New Mexico
    Posts
    137
    Rep Power
    11
    Well, when I work on a GUI, I start from the top to the bottom. Starting out with the main frame, I add the menubar, then the internal widgets, then the statusbar (if any), checking the code all the way..
  8. #5
  9. CAUTION: Loderator Moose
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Nov 2004
    Location
    some starry place (india)
    Posts
    3,431
    Rep Power
    162
    thanks.. i just tried that system of building up my program.. it did improve my error detection rate..
    Thanks mawe, i finished that program alright.
    Nigel
    ..Seeking code free nirvana...
    Nigel Fernandes Blog
    Never argue with fools. They will bring you down to their level and beat you with experience.


    Manchester United Forever

IMN logo majestic logo threadwatch logo seochat tools logo