Building a GUI Toolkit

Discussion in 'Python' started by Tim Diels, Apr 18, 2010.

  1. Tim Diels

    Tim Diels Guest

    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
     
    Tim Diels, Apr 18, 2010
    #1
    1. Advertising

  2. 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 :)

    --
    mph
     
    Martin P. Hellwig, Apr 18, 2010
    #2
    1. Advertising

  3. Tim Diels

    Lie Ryan Guest

    On 04/19/10 03:06, Martin P. Hellwig wrote:
    > 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.
    >


    Rather than writing a windowing toolkit from the low-level, I would
    rather like to see some wrapper for existing windowing toolkit which
    uses more pythonic idioms.

    Most popular python GUI toolkit currently in use are only a simple thin
    wrapper over the library they're wrapping and exposes a lot of the
    design considerations of the language that the toolkit was originally
    written in. Yes, even Tkinter that comes with the standard lib is a hack
    on top of python and looks much more Tcl-ish than pythonic.

    I have always had the idea of writing a windowing toolkit wrapper that
    creatively uses python features for maximum expressiveness (e.g.
    decorator, with-statement, for-each), but never got the time to write
    anything like that.
     
    Lie Ryan, Apr 20, 2010
    #3
  4. On 04/20/10 19:53, Lie Ryan wrote:
    <cut>
    >
    > Rather than writing a windowing toolkit from the low-level, I would
    > rather like to see some wrapper for existing windowing toolkit which
    > uses more pythonic idioms.
    >
    > Most popular python GUI toolkit currently in use are only a simple thin
    > wrapper over the library they're wrapping and exposes a lot of the
    > design considerations of the language that the toolkit was originally
    > written in. Yes, even Tkinter that comes with the standard lib is a hack
    > on top of python and looks much more Tcl-ish than pythonic.
    >
    > I have always had the idea of writing a windowing toolkit wrapper that
    > creatively uses python features for maximum expressiveness (e.g.
    > decorator, with-statement, for-each), but never got the time to write
    > anything like that.


    Well I suppose you could piggyback on tk for that and rewrapping tkinter
    to be more pythonic is probably more doable than rewriting it from scratch.

    --
    mph
     
    Martin P. Hellwig, Apr 20, 2010
    #4
  5. On 04/20/10 21:15, Martin P. Hellwig wrote:
    > On 04/20/10 19:53, Lie Ryan wrote:
    > <cut>
    >>
    >> Rather than writing a windowing toolkit from the low-level, I would
    >> rather like to see some wrapper for existing windowing toolkit which
    >> uses more pythonic idioms.
    >>
    >> Most popular python GUI toolkit currently in use are only a simple thin
    >> wrapper over the library they're wrapping and exposes a lot of the
    >> design considerations of the language that the toolkit was originally
    >> written in. Yes, even Tkinter that comes with the standard lib is a hack
    >> on top of python and looks much more Tcl-ish than pythonic.
    >>
    >> I have always had the idea of writing a windowing toolkit wrapper that
    >> creatively uses python features for maximum expressiveness (e.g.
    >> decorator, with-statement, for-each), but never got the time to write
    >> anything like that.

    >
    > Well I suppose you could piggyback on tk for that and rewrapping tkinter
    > to be more pythonic is probably more doable than rewriting it from scratch.
    >


    On second thought, if you would like borderless windows (for example to
    implement all widgets from scratch), you run into troubles, as
    overrideredirect also affects the keyboard focus, so you can't use the
    keyboard in any widget created. And also it would be ice to still have
    an iconify option.

    --
    mph
     
    Martin P. Hellwig, Apr 21, 2010
    #5
  6. > Rather than writing a windowing toolkit from the low-level, I would
    > rather like to see some wrapper for existing windowing toolkit which
    > uses more pythonic idioms.


    Isn't PyGUI exactly that?
    http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/


    --
    дамјан ((( http://damjan.softver.org.mk/ )))

    Spammers scratch here with a diamond to find my address:
    |||||||||||||||||||||||||||||||||||||||||||||||
     
    Дамјан ГеоргиевÑки, Apr 21, 2010
    #6
  7. Tim Diels

    Tim Diels Guest

    On 20/04/2010 20:53, Lie Ryan wrote:
    > On 04/19/10 03:06, Martin P. Hellwig wrote:
    >> 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.
    >>

    >
    > Rather than writing a windowing toolkit from the low-level, I would
    > rather like to see some wrapper for existing windowing toolkit which
    > uses more pythonic idioms.
    >
    > Most popular python GUI toolkit currently in use are only a simple thin
    > wrapper over the library they're wrapping and exposes a lot of the
    > design considerations of the language that the toolkit was originally
    > written in. Yes, even Tkinter that comes with the standard lib is a hack
    > on top of python and looks much more Tcl-ish than pythonic.
    >
    > I have always had the idea of writing a windowing toolkit wrapper that
    > creatively uses python features for maximum expressiveness (e.g.
    > decorator, with-statement, for-each), but never got the time to write
    > anything like that.


    When (or if) I'd finish this low-level gui toolkit, I'd incorporate it
    into my original plans, which were: writing a library that provides the
    programmer with 1 API, yet can display the GUI in a terminal (curses),
    on the desktop(X/win32/...) or in your web browser (DHTML). Terminal
    support would likely be very limited though.

    I think I'll go ahead and try to write a wrapper around pyglet and start
    writing some basic widgets.
     
    Tim Diels, Apr 22, 2010
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. asdf
    Replies:
    0
    Views:
    590
  2. Elhanan

    xml building toolkit?

    Elhanan, Dec 22, 2005, in forum: Java
    Replies:
    0
    Views:
    341
    Elhanan
    Dec 22, 2005
  3. Alessandro Pinto

    Standard GUI Toolkit

    Alessandro Pinto, Feb 7, 2004, in forum: C++
    Replies:
    13
    Views:
    777
    Dylan Nicholson
    Feb 12, 2004
  4. Mike C. Fletcher
    Replies:
    6
    Views:
    380
    =?ISO-8859-1?Q?Michael_Str=F6der?=
    Jul 30, 2004
  5. Paul Moore
    Replies:
    0
    Views:
    343
    Paul Moore
    Apr 13, 2006
Loading...

Share This Page