I recently began to implement some game prototypes with the help of Kivy, a very interesting Python library originally developed to prototype innovative user interfaces. Combined with IPython, Kivy could also be interesting for live coding, and so I checked out how the input hooks for other event loops work in IPython. Currently, there are hooks for Qt, glut, pyglet, GTK, wx and tk build in. That means that you can use any of those frameworks to develop GUI apps interactively from within an IPython shell.
For Kivy, I copied one of the existing hooks and came up with the following code:
https://github.com/pbouda/stuff/blob/master/kivy_livecode/helpers.py
The function enable_kivy() would return an Kivy app object that you can then use to add widget interactively. Just start an IPython shell and add a rectangle to a Kivy window, for example:
[1] import helpers
[2] app = helpers.enable_kivy()
[3] from kivy.graphics import *
[4] with app.root.canvas:
Color(1.0, 0.2, 0.0)
Rectangle(pos=(850,450), size=(200,200))
Unfortunately, you have to patch the Kivy sources to run in interactive mode at the moment. Kivy has a so-called slave mode, but it is not available when you call the default run() method on the App object. Here is a simple patch that just pipes the slave parameter to the runcTouchApp() method and will allow you to start the Kivy app in slave mode:
https://github.com/pbouda/kivy/commit/e1659dea1986f4a6006193d697c86d3694652cc1
Have fun!
About me
I work since more than 20 years as a developer, product manager and AI lead with language technologies. Starting with speech recognition and machine translation I now focus on education in semantic technologies and LLMs.
Check out my AI trainings.
Contact me and book your training.