5

We have console application option in C#, but how do I can make a console GUI in python? I should note I want to compile and use my program in windows. Also I want to select Items in Python GUI by Enter button.

2

2 Answers 2

12

If you're using Windows you will ultimately need to integrate with the win32 console API to create a console GUI (aka. a Text UI or TUI). Your options are basically:

  1. Write your TUI using curses or the packages that sit on top of it, like urwid or npyscreen. To do this you either need to install cygwin or PDcurses to make it work.
  2. Write to the win32 API directly using something like pywin32.
  3. Use a package that simplifies the win32 API like effbot's console package.

I found all the above unsatisfactory as I didn't want all the hassle of installing 3rd party binaries for Windows and wanted an API that I could use anywhere (after a simple pip install), so I wrote a cross-platform package (asciimatics) to fix it. This package takes all the hassle away and provides a clean, documented API with a set of widgets for TUI applications.

For example the following is a screenshot of the contacts list sample code referenced in the previous docs link, showing some of the basic text and button widgets.

Sample screenshot

Sign up to request clarification or add additional context in comments.

3 Comments

I would suggest a screenshot of what asciimatics programs looks like. Not necessarily in your answer, but at least on your documentation page. It sounds cool but I would have like to have seen an example somewhere. (unless there is and I didn't find it?)
Thanks. I've yet to create a video for the gallery so have added a screenshot here for now instead...
Thanks, it's way cooler then I was picturing. Good job! It puts my terminal screensavers to shame.
1

Take a look at Python's curses library:

If you'd like a Python shell, then you might want to look at something like PyFlakes / PyShell or similar.

2 Comments

I should note that I need console application GUI for user interface not for development. I am working on simple accounting program for a small business so I need a simple (similar to Dos) GUI for users.
Urwid (on excess.org/urwid) is a sample. But I don't know how use it on windows 7.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.