last edited Aug 31 2017 by Bill Robinson | Created by Bill Robinson | Other contributors:
Enabling students to concentrate on core concepts and application logic
Inspired by and extending Laura Sach’s guizero framework, ggui is intended to both enable and simplify the creation of a wide variety of small desktop applications by my GCSE and A-level students. Its main objective is to enable students to focus on core concepts and application logic rather than on pack/grid/etc., and so I thought it might perhaps be of interest to other teachers who use Python 3. It needs further work, but if you want to try it out ‘as-is’ simply dump the whole lot in an empty folder and run the examples, which should be reasonably self-explanatory (there are no dependencies other than tkinter). Further documentation is in the comments in the App, CanvasBG, ChildWindow, and Plotter files, and below.
The attached screenshots demonstrate ggui usage, and the zipped file contains the example code and the ggui folder which (for now) can be simply dropped into a student’s program’s folder.
Considerable liberties have been taken for the sake of simplicity of use (though many will probably disagree with this approach), and the creation of child windows, widgets and graphics, etc. is done via functions which are bound to the main module or to each child window:
framerate(nn), where nn is the desired framerate, will restart it.
every(1000, print, 'Hello', 'World'); In this way every can be used to create a secondary/alternative animation or event handling loop
if key('space'): ...; see e.g. ex2g3.py, which polls keys pressed on the child window
bars; range, labels and ‘tick size’ can be specified by the user. Tk < 8.6 does not support drawing angled text and so if a lesser version is present an alternative form of labelling of the y-axis and column charts is done. If plotting in a child window make sure you call show() before calling plotter
right(these last four can also be use as setters),
overlaps(the latter tests whether an overlap exists with another sprite/canvas item ).
next_costumewhilst graphics items offer
colorwhich enables their stroke and fill to be changed (see ggui/CanvasBG.py for method parameters)
stroke_width); point and label have a stroke keyword argument, line has stroke and stroke_width, and all other graphic items have stroke, fill, and stroke_width keyword arguments. Colors may be specified using either hexadecimal strings or rgb tuples, and the hue of an RGB or hexadecimal color may be altered using color_shift
This has all been done in rather a rush for the start of term and so very probably contains some glaring errors I’ve overlooked - it’s not been fully tested yet, and comes with no warranties whatsoever. If you do try it out and come across errors please let me know, and I will update the version here when bugs show up.
License/warranty terms are stated in the license.txt file included in the download, but are essentially the same as those of guizero.
Level: (Beginner / Intermediate/ Advanced)
By downloading this resource you agree to the CAS resource guidelines and use it appropriately.
Note: Unless otherwise specified, this resource and all associated files are published here under the Creative Commons Attribution-Share Alike 3.0 Licence. If you wish to use a different license, please state this in the description.