Thread: wxPython

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    44
    Rep Power
    11

    wxPython


    Ok this is a dumb question but I can't find any other way... I'm programming a gui in wxPython.. let say if I have 2 text box, the first one for user input, and the second one display the answer... my program will run like this.. the user will insert numbers in the first text box.. then the program will multiply the number with 2 then display the answer in the second text box.. how could I do this... I tried it copule of times but keep getting error... Thank you
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    What Error are you getting? Might also help if you post the problem code

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

  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    44
    Rep Power
    11
    Originally Posted by netytan
    What Error are you getting? Might also help if you post the problem code

    Mark.
    here's what I got

    Code:
    Traceback (most recent call last):
      File "C:\Python22\Test\gui3.py", line 23, in OnClear
        inch = a/2.54
    TypeError: unsupported operand type(s) for /: 'str' and 'float'
    I know it's dumb thing.. but I'm just starting out with GUI stuff.. so need to get something clear..Another thing, is there anyway I could use Python to access and manipulate MS Access database??
  6. #4
  7. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,642
    Rep Power
    4247
    Try this instead:
    inch = float(a)/2.54
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  8. #5
  9. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,642
    Rep Power
    4247
    As for fiddling with MS Access, what say you try out my ADO tutorial
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  10. #6
  11. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    Typically you might have a "Calculate" button widget which wxPython will use to launch an on-click event signal that will be routed to your on-click event handler function.

    You will need too assign the event to the handler function in your code.

    The event handler function then reads your two values from the two entry widgets, calculates the answer then updates the output widget.

    BTW are you using the Boa Constructor? Boa make the business of tying events to functions pretty easy.

    Grim.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    44
    Rep Power
    11
    Originally Posted by Scorpions4ever
    Try this instead:
    inch = float(a)/2.54
    Thanx.. it works... now hwre could I get the full wxPython manual/documentation??
  14. #8
  15. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    If you have installed wxpython under Windows then this package also include the documentation found in the start menu.

    wxpython also has docs online.
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    7
    Rep Power
    0
    Hello,
    In the wxPython directory on Linux there also is a "demo" directory with many and good examples. In the demo directory you can simply launch "demo.py". ( I suppose it also were installed on Windows )

IMN logo majestic logo threadwatch logo seochat tools logo