Building a GUI Toolkit

Martin P. Hellwig martin.hellwig at
Sun Apr 18 19:06:45 CEST 2010

On 04/18/10 12:49, Tim Diels wrote:
> Hi
> I was thinking of writing a GUI toolkit from scratch using a basic '2D
> library'. I have already come across the Widget Construction Kit.
> My main question is: Could I build a GUI toolkit of reasonable
> performance with the Widget Construction Kit, would it still feel more
> or less lightweight? By reasonable I mean that the user wouldn't think
> of the interface as being slow or unresponsive.
> I've also thought of using pyglet to build widgets with, but this would
> seem to be overkill. As a side question: by using opengl, the work would
> be delegated to the GPU rather than the CPU; is this always a good
> thing, or does it have downsides as well (performance, power usage, ...)?
> Are there any other libraries that may be of interest to me?
> Thanks in advance

It probably depends on how low level you want to go, I have pondered 
about the possibility myself to have an all python(ic) gui toolkit, 
capable of writing a (x11) windowing manager itself with.
But I decided that using tkinter and just live with its rough corners is 
more bang for the buck for me than to reimplement tkinter badly.

However as a thought exercise I did spend some energy on it and I had 
the following ideas.
- Need to have direct access to at least x11, cocoa  and win32gui;
   or even lower than that (if possible/reasonable).
- Only need to abstract enough so I can display a borderless window full
   screen or on any position/size.
- Need to provide a wrapper for the input devices too, e.g.: keyboard,
   mouse, joystick, touchscreen, etc.
- Optionally graphical acceleration (OpenGL, DirectX, SDL?)
- It would be good that fonts, windows, decoration and icons are all SVG
   so that all these items can scale independently.

I also had some more questions:
- How about providing an interface for video playback?
- How about audio?
- How about printing?
- How about multiple displays?
- How about odd sized displays (round, triangle, etc)?
- How to handle 'legacy' gui applications?
- Need to remain completely BSD licensed so that it is possible that it
   might some day be incorporated in the standard distribution.

So I gave up on it as it seem to me much to much work for not enough 
ROI, but I still would welcome anyone giving it a shot :-)


More information about the Python-list mailing list