Hi,
I am finding it pretty tough to adapt wxPython code to be platform
independent -- particularly in contrast to some of the other packages
I have used in the past. I am interested in advice on how to generate
simple and platform independent code. As an example of one current
frustration, the following code snippet works fine on Windows and Mac,
but is not pretty on Linux:
(Version A)
def ElButton(self, name, pos, tip, color):
El = wscs.ColourSelect(label=name, parent=self,
pos=pos, size=wx.Size(24, 23),
style=wx.RAISED_BORDER,colour=color)
El.SetLabel(name)
El.SetToolTipString(tip)
El.Bind(wx.EVT_BUTTON, self.OnElButton)
(for screen dumps, see http://ftp.xor.aps.anl.gov/11bm/toby/A.fc10.png
http://ftp.xor.aps.anl.gov/11bm/toby/A.osx.png
While this version of code works fine on Windows and Linux, but is
useless on Mac:
(Version B)
def ElButton(self, name, pos, tip, color):
El = wx.Button(id=wx.ID_ANY, label=name, name=name,
parent=self,
pos=pos, size=wx.Size(24, 23), style=0)
El.SetBackgroundColour(color)
El.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.BOLD, False,
'Tahoma'))
El.SetLabel(name)
El.SetToolTipString(tip)
El.Bind(wx.EVT_BUTTON, self.OnElButton)
(for screen dumps, see http://ftp.xor.aps.anl.gov/11bm/toby/B.fc10.png,
http://ftp.xor.aps.anl.gov/11bm/toby/B.osx.png
& http://ftp.xor.aps.anl.gov/11bm/toby/B.xp.png)
Are there better approaches to developing portable wxPython apps
without having to write code conditional by sys.platform?
Brian