GUI Frameworks in Python?

DH no at sp.am
Wed Apr 7 03:02:55 EDT 2004


Josiah Carlson wrote:
>>> That's just one example of how the PyGtk API is simpler. It might
>>> not sound like much, but lots of little things like that add up
>>> to make me like PyGtk much better.
...

> What parts of the 2.4 to 2.5 conversion are steps backward?

Here's one example of unneeded extra typing, compared to virtually every 
other GUI API, to further illustrate Josiah's point:

Java drawline: (AWT & Swing)
   graphics.drawline(x1,y1,x2,y2)

Visual Basic drawline:
   graphics.drawline(pen,x1,y1,x2,y2)

pyqt drawline:
   painter.drawline(x1,y1,x2,y2)

anygui drawline: (wraps wxpython and other guis)
   canvas.drawLine(x1,y1,x2,y2)

piddle drawline: (wraps wxpython and other guis)
   canvas.drawline(x1,y1,x2,y2)

pythoncard drawline (wraps wxpython)
   drawline(x1,y1,x2,y2)

pygtk drawline:
   draw_line(drawable, gc, x1, y1, x2, y2)

tkinter drawline:
   canvas.create_line(x1,y1,x2,y2)

pygame drawline:
   pygame.draw.line(surface,(r,g,b),(x1,y1),(x2,y2))

wxPython 2.4 drawline:
   wxdc.drawline(x1,y1,x2,y2)

wxPython 2.5 drawline:
   wxdc.drawline (wxPoint(x1,y1),wxPoint(x2,y2))
   or the much simpler ((x1,y1),(x2,y2))
   or you can do drawlineXY(x1,y1,x2,y2)

Admittedly, wxPython is still simpler than OpenGL:
def drawline(x1,y1,x2,y2):
     glBegin (GL_LINES)
     glVertex2f (x1,y1)
     glVertex2f (x2,y2)
     glEnd ()



More information about the Python-list mailing list