Python Forum
looking for example code for GUI
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
looking for example code for GUI
#1
i am looking for complete and working examples of GUI things done in Python with your favorite GUI tools.

best would have a range of complexity from very simple to very complex

a nice simple program brings up a window showing given text and having a text input area with nice editing, a submit button (and/or accepts enter key to submit), and outputs the typed in text to stdout (e.g prints it).

know of any sites with a good collection of GUI sample code in Python?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
You can start with this
http://www.tutorialspoint.com/pyqt/

First of all you must decide which framework you will work with.
Here is a list with all GUIs for Python.
https://wiki.python.org/moin/GuiProgramming

The most active are PyQt and Pyside.

PySide comes with two flavors. PySide1 which is QT4 framework. It is stopped developed because the QT has gone to new version QT5.
So we have PySide2, which is QT5 framework.
A note. PySide2 is founded and supported by Qt Company and it is the official package of QT for Python.
Although, it is not very active community.

PyQt comes also with two flavors.
One community edition and one commercial edition.
PyQt is been developed by a company named Riverbank.
The project is mature with no bugs and it has a very active community and you get great help from mailing-list

Personally i prefer PyQt.
Reply
#3
For tkinter:

If you download the example code that was part of the Grayson Tkinter book (Wiley publishing), there is a demo section.
In that demo section are individual programs for each of the tkinter, ttk, and pmw widgets,

Also, another, I'll call it a dispatcher program (all.py) that:
   1. launches each of the individual demos, and
   2. displays the script behind each at the push of a button.

This is old code, and unfortunately python 2.7, but is easy to convert to python 3
It was so well written that it is entirely valid today

If you can't find the code, I have it, already converted to 3.4, on a backup drive 'Somewhere'
Reply
#4
(Oct-30-2016, 04:50 AM)demosthenesk Wrote: http://www.tutorialspoint.com/pyqt/

most code here is snippets.  i want whole code i can put in a file and run.  the hello world example here worked.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#5
Also you might want to look at pygame.
http://pygame.org/hifi.html
Reply
#6
Quote:a nice simple program brings up a window showing given text and having a text input area with nice editing, a submit button (and/or accepts enter key to submit), and outputs the typed in text to stdout (e.g prints it).
What you plan on using it for depends on what library you use. Which then turns into what examples you get as a response here. But we dont know what this.

Quote:Also you might want to look at pygame.
http://pygame.org/hifi.html
I started collecting classes, such as a button/input box (mostly from mekire), but i didnt get too far before i stopped
https://github.com/metulburr/pygooey
Pygame has no basic GUI tools. So you have to create everything yourself. So if your not making a game, its best wise to use a different library.
Recommended Tutorials:
Reply
#7
Also:
Quote:In that demo section are individual programs for each of the tkinter, ttk, and pmw widgets,

I should note that each of these is a full script that will run by itself

This is an edited addition. The modules are all generated with Pmw
But with little or no modification should run in tkinter (python 3)

These will all run on python 3, Pmw may have to be installed.

Running all.py will start

Attached Files

.zip   demos.zip (Size: 143.02 KB / Downloads: 306)
Reply
#8
this is for learning the scope of GUI ... e.g. how much is involved in doing certain things.  i have never done GUI before (in all my programming done in C, Pike ... etc.   modules that i need to install should be from what i can install with apt-get (Ubuntu) and/or pip.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#9
?? No matter what you do, with any GUI, at some point you need to get to
the basic widgets that are available, their attributes and how they are used.
The demo package is part of the PMW package, which is distributed as a tar.gz file. (or you can get it with pip)
Each module in the demo is dedicated to one, particular widget, and can be run by itself.

The Pmw package itself is installed with 'pip install Pmw'
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020