PyGTK vs. wxPython

Szabolcs Nagy nszabolcs at gmail.com
Wed Apr 27 17:22:32 EDT 2005


I forgot to mention in my previous post that the best thing in wxPython
is the wxPython demo. It helped me a lot. Browsing through the examples
usually faster than browsing through the api doc.

About XRCed:
I put every static components of the window layout in an xml file with
XRCed
(not static components: buttons moving around, changing labels ...)

Generally my code looks like:

import wx
import wx.xrc

class Frame(wx.Frame):
	def __init__(self, parent, resource):
		w = resource.LoadFrame(parent, 'FrameName')
		self.PostCreate(w)
		self.SetIcon(wx.Icon('myapp.ico', wx.BITMAP_TYPE_ICO))

		...
		#lots of init code here

	...
	#event handlers here


class App(wx.App):
	def OnInit(self):
		resource = wx.xrc.XmlResource('myapp.xrc')
		self.f = Frame(None, resource)
		self.f.Show()
		return True

if __name__ == '__main__':
	app = App()
	app.MainLoop()




More information about the Python-list mailing list