[Tutor] graphics library for teaching Python
I'm a computer science tutor and I'm asking advice about a graphics or game library that can be used with Python effectively for teaching purposes. I've found that having my student pick a long-term project is a good way for them to learn coding, and graphics or games make great projects that both have stimulating results and bring computer-science-y topics into the mix (i.e. they are natural vehicles for OO, data structures, and algorithms). 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. I've been using PyGame, but I'm not happy with it. It's not very well organized or documented, and not very capable of general graphics. So I'm looking into a few other possibilities. No library can be everything to everyone, but I'd like something that gives students exposure to a variety of programming tasks, like constructing GUIs, events and event loops, and 2-D graphics via stroking and filling common polygon shapes and Bezier curves. (3D is not necessary for now.) Here are some alternatives to PyGame: - Pyglet. Doesn't look promising. I'm mainly interested in 2D, and I don't see common data visualization tasks provided like filling and stroking Bezier curve shapes (maybe I'm missing something). - Cairo. Looks great for static 2D graphics, but not games .. again maybe I'm missing something. - Cocos2D. Good for games but not necessary general 2D graphics. - PyQt. I used this extensively at my last regular desk job many years ago, and if I recall it has the QCanvas element with pretty deep graphics ability and also event handling. It has collision detection too, I think, allowing for easy 2D game writing. It looks to me like PyQt is the most capable program and most related to what I want to do, but one thing I'm wondering about is how widely its used and whether it would be good exposure for students to connect them to the wider world of computing they will someday enter. Any thoughts would be appreciated. Mike ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] graphics library for teaching Python
On Fri, Dec 21, 2018 at 9:15 AM Mike Barnett 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