"Hello, world"?

CM cmpython at gmail.com
Wed Oct 28 22:08:19 CET 2009


On Oct 28, 5:40 am, Gilles Ganault <nos... at nospam.com> wrote:
> Hello
>
> I'm reading O'Reily's "Python Programming on Win32", but couldn't find
> a simple example on how to create a window with just a label and
> pushbutton.
>
> If someone has such a basic example handy, I'm interested.
>
> Thank you.

In wxPython (which you would have to download and install), it could
be something like:

import wx

class Dialog1(wx.Dialog):
    def __init__(self, parent):
        wx.Dialog.__init__(self, id=-1, name='', parent=parent,
              pos=wx.Point(132, 174), size=wx.Size(149, 80),
              style=wx.DEFAULT_DIALOG_STYLE, title='')

        self.staticText1 = wx.StaticText(id=-1,
              label=u'Hello, World', name='', parent=self,
              pos=wx.Point(40, 16), size=wx.Size(59, 13), style=0)

if __name__ == '__main__':
    app = wx.PySimpleApp()
    dlg = Dialog1(None)
    try:
        dlg.ShowModal()
    finally:
        dlg.Destroy()
    app.MainLoop()



More information about the Python-list mailing list