For PySimpleGUI….
Things like “collision detection” are up to the application.  PySimpleGUI gives 
you ability to place “objects” at x,y coordinates.  The primitives allow 
images, circles, lines, rectangles, arcs, and text to be drawn and removed.  If 
one overlaps another you’re on the hook for determining that.

GUIs
PySimpleGUI rocks for doing custom GUIs.  At last count there were 28 widgets 
that you can place pretty much anywhere within a window.  These are the basic 
widgets (buttons, listbox, checkbox, radio button, etc.) as well as advanced 
Panes and Button-Menus.  It’s excellent for teaching GUIs and how to layout a 
GUI because all of the widgets are available for the developer, not a subset.

You can run sync and async event loops so doing things like polling hardware 
devices is easy.  No callbacks to worry about.
Here’s a description of the architecture
https://pysimplegui.readthedocs.io/architecture/

Determining which button was clicked is as easy as a comparison:
if button == ‘Download’:
   do_download_stuff()

Animation is a super easy to do as all you’re doing is showing images in a loop.

Here’s a program that does a simple graph of a math function that allows you to 
change the variables using a couple of sliders.  It demonstrates the “graphing” 
capability.
https://gist.github.com/MikeTheWatchGuy/8453e82fc65e24060775443e843ab80b


One big drawback for tkinter / PySimpleGUI is the inability to have an image as 
the background.  You can have an image for the background of a canvas, but of 
the entire window.  For that you’ll need to use PySimpleGUIQt.

Anyway, it’s worth a look to see if it fits some of your needs.


@mike<mailto:mike_barn...@hotmail.com>

From: Michael Mossey <michaelmos...@gmail.com>
Sent: Friday, December 21, 2018 1:40 PM
To: Mike Barnett <mike_barn...@hotmail.com>
Cc: tutor@python.org
Subject: Re: [Tutor] graphics library for teaching Python



On Fri, Dec 21, 2018 at 9:15 AM Mike Barnett 
<mike_barn...@hotmail.com<mailto:mike_barn...@hotmail.com>> wrote:
>There are two sub-topics I'm interested in - (1) graphics, as in drawing 
>interesting pictures or art, or using diagrams for data visualization. (2) 
>Simple games, with the use of sprites.

Can you post some images of similar programs / graphics you are wanting to 
create?  It would be extremely helpful to see concrete "targets".  Then I can 
better inform you if PySimpleGUI is capable of doing what you seek.

I think PySimpleGUI might be a great fit.

I'm getting my ideas from projects way in the past, so I can't easily find 
screenshots. But what I'm looking for is pretty easy to describe.

for graphics: "Capabilities similar to JavaScript canvas plus collision 
detection."

In other words, basic text filling/stroking, basic shape and line and Bezier 
curve filling/stroking, and then collision detection to make simple games 
easier.

for GUIs: "Basic dialogs, buttons, labels, checkboxes, and integrated canvas."

My students range a lot in age and ability. Youngest is 9th grade, ranging 
upward to professionals who are looking to learn programming as a new skill to 
use in the workplace or put on their resume.



I've recently been writing more games using PySimpleGUI to see what's missing 
in the SDK, to determine new features that will help developers.

For data visualization, there's Matplotlib and Pyplot, both integrate with 
PySimpleGUI very well.  Someone mentioned Turtle, it too integrates well by 
using a tkinter canvas.

By data visualization, I don't mean necessarily plotting. Matplotlib might be 
an awkward fit.

I'm thinking of visualizing math processes, algorithms, and so forth. Say, we 
animate a cubic curve changing shape while the coefficients change. Or we 
animate the inner workings of a tic tac toe strategy algorithm by having it 
draw a tic tac toe board with changing colors or shapes to represent positions 
or calculations in progress. I don't mean something really complicated. Just 
picture the simplest thing that makes sense.

Thanks for the other links to examples.

Mike


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to