Application with both console and gui mode
        Posted  
        
            by mridang
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by mridang
        
        
        
        Published on 2010-05-13T14:28:25Z
        Indexed on 
            2010/05/13
            15:44 UTC
        
        
        Read the original article
        Hit count: 326
        
Hi,
I have a python console app. Like most python console apps it uses the OptionParser module to take arguments. I've now developed a GUI for my app using wxPython and i'd like to integrate the two. I'd like my app to be run both from the console and from the OS's UI. When it is invoked from the console it runs as a console app and when it is double clicked in the OS's UI, it runs as a GUI app. How could I do something like this? Could someone show me a a snippet of what the __main__ block should be like?
Thanks a ton.
© Stack Overflow or respective owner