Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7435611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:06:11+00:00 2026-05-29T10:06:11+00:00

I have a python program with a wxpython GUI and some command line parameters.

  • 0

I have a python program with a wxpython GUI and some command line parameters. I generate a single windows executable with py2exe. I don’t want to have a command line window in the background, so py2exe is making this a pythonw executable without this window. This is equivalent to use the *.pyw extension.

The problem is, if you want to see the available command line arguments, you naturally do “main.exe -h” on a shell. Even though argparse is providing this information, it doesn’t reach stdout because of the *.pyw extension.

So how could I re-enable stdout for a GUI application using pythonw?

minimal working example:

# test.py
print "hello"

execution:

#> python test.py
hello
#> pythonw test.py
#> 

Thanks in advance for any suggestion!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:06:13+00:00Added an answer on May 29, 2026 at 10:06 am

    I finally solved my problem with some kind of a nasty trick. I get the help information from argparse like that:

    class Parser(object):
        def __init__(self):
            [...init argparser...]
            self.help = ""
            self.__argparser.print_help(self)
        def write(self, message):
            self.help += message
    

    Then I just show the help information in the about dialog.

    I would still prefer to re-enable sys.stdout, but this works for now.
    Thanks to all suggestions!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a python program which opens a new windows to display some 'about'
I have a Python/wxPython program where the GUI is the main thread and I
I have Windows Vista 64-bit SP2. I am trying to use wxPython for GUI
Just as the title goes. I have a python program which processes some data
I have a python practise project. I'm going to write a GUI program which
I have a python program that implements pygtk for GUI. I have it running
I have a Python program that sends keystrokes to another application using SendKeys. Some
I'm currently writing a program in python with a gui using wxpython. The program
I have a Python 2.7.2 program with wxPython 2.8.12 and comtypes 0.6.2 dependencies on
I have a python program that has no windows frame and doesn't show up

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.