Simple problem with GUI!!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mohan

    #1

    Simple problem with GUI!!

    Hello Guys,

    I am a beginner with Python programming and would like to implement
    some GUI functionalities along with my main work. So I was trying to
    implement one basic program (available from books).
    Here is the code,

    ############### #############
    import Tkinter

    TopLevelWindowO bj = Tkinter.Tk() # Creating a root window
    QuitObj = Tkinter.Button( TopLevelWindowO bj, text = "QUIT", command =
    TopLevelWindowO bj.quit) # Creating a Button
    QuitObj.pack() # Positioning the button
    Tkinter.mainloo p()
    ############### ##############

    So, this is a code to display a window with a "QUIT" button and by
    clickign the button the entire window is closed. When I execute this
    program, the window does not close down but the window is completely
    disabled and after a few seconds I get the following message in a
    message window,

    *************** *************** *************** *************** **************
    Message box name - Microsoft Visual C++ Runtime Library

    Runtime Error!

    program...\Pyth on22\core\lib\s ite-packages\Python win\Pythonwin.e xe

    This application has requested the Runtime to terminate it in an
    unusual way.
    Please contact the application's support team for more information.

    *************** *************** *************** *************** *************** *********
    At the end I had to close down my entire python compiler. I am using
    Python compiler with following specs in Windows XP OS.

    Pythonwin - Python IDE and GUI Framework for Windows.
    PythonWin 2.2.1 (#34, Feb 25 2003, 11:29:09) [MSC 32 bit (Intel)] on
    win32.
    Portions Copyright 1994-2001 Mark Hammond

    Please let me know why is this happening and also if I am missing
    something in the way of programming.

    Thanks in advance.

    Cheers,
    Mohan.

  • Fredrik Lundh

    #2
    Re: Simple problem with GUI!!

    "mohan" wrote:
    At the end I had to close down my entire python compiler. I am using
    Python compiler with following specs in Windows XP OS.
    >
    Pythonwin - Python IDE and GUI Framework for Windows.
    PythonWin 2.2.1 (#34, Feb 25 2003, 11:29:09) [MSC 32 bit (Intel)] on
    win32.
    Portions Copyright 1994-2001 Mark Hammond
    >
    Please let me know why is this happening and also if I am missing
    something in the way of programming.
    the PythonWin IDE doesn't work properly when you're running programs that
    does their own Windows event handling. this is a problem with PythonWin, not
    with Tkinter or your program. to solve this, you can either

    1) check if you can make PythonWin run the program in a separate process

    2) explicitly run the program in its own process (using "python.exe " or "pythonw.ex e"),
    from the command line.

    3) switch to an IDE that runs Python code in a separate process (such as IDLE,
    Wing, and most other modern IDE:s).

    </F>



    Comment

    Working...