[wxPython-users] Adding GUI to already existing CLI framework
Karsten Hilbert
Karsten.Hilbert at gmx.net
Tue Aug 7 04:25:51 PDT 2007
>> Probably you need wx.lib.pubsub which is independent of wx. You can just
>> copy the file pubsub.py to your application in case you want to drop wx.
> Yes, this is how I usually do it, and you can see it at
> http://wiki.wxpython.org/ModelViewController as Andrea mentioned. Scroll
> down for an example. If you want your model/controller to be non-dependent
> on wx, you can either copy in the pubsub.py as Stani mentioned, or what I
> usually do is something like:
>
> try:
> import wx.lib.pubsub as pubsub
> PUBSUB = True
> except:
> PUBSUB = False
>
>
> Then wherever you would use pubsub to send a message, just check 'if
> PUBSUB: ' first. This to me seems like an elegant solution because if you
> can't import wx you have no gui and therefore no need to send messages to
> one (not that it hurts to send messages if no one is listening). I also
> feel a little hackish copying a file from wx into my local space like that
This is why I think pubsub really should be included with
Python itself. Anyone up to the task (that is, with a bit of
time and persistence on their hands) of suggesting that to
the Python community ?
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346
More information about the wxpython-users
mailing list