Dear Friends of wxPython,
Many thanks for your replies, efforts, and sincere goodwill. Please don’t stop i can still use more ideas and explanations.
But i was graced to lookup, with inspiration from Che and Frank, the ComboTreeBox.py custom widget that resides in the wx/lib folder written by Frank Niessink. He comments and codes all the idiosynchrasies of each platform and as shown below creates “a poor man’s Combobox ourselves using a TextCtrl and a BitmapButton.”
I don’t understand most of the code in his custom widget but the below i can handle. So now i will hack away at using this code as a base and create an immitation combobox that is eventually truly cross platform.
p.s. To Frank Millman, who has worked so hard and long on this concept already, with your knowledge and skills you could probably dissect this custom widget and rework it into a usable immitation combobox. If you do Please let me know. I will post any good results and questions i come up with.
Markandeya
class BasePopupFrame(wx.Frame):
“”"
BasePopupFrame is the base class for platform specific
versions of the PopupFrame. The PopupFrame is the frame that
is popped up by ComboTreeBox. It contains the tree of items
that the user can select one item from. Upon selection, or
when focus is lost, the frame is hidden. “”"
… lots more code here
class GTKComboTreeBox(BaseComboTreeBox, wx.Panel):
“”" The ComboTreeBox widget for wxGTK. This is actually a work
around because on wxGTK, there doesn’t seem to be a way to intercept
mouse events sent to the Combobox. Intercepting those events is
necessary to prevent the Combobox from popping up the list and pop up
the tree instead. So, until wxPython makes intercepting those events
possible we build a poor man’s Combobox ourselves using a TextCtrl and
a BitmapButton. “”"
def _createPopupFrame(self):
return GTKPopupFrame(self)
def _createTextCtrl(self):
if self._readOnly:
style = wx.TE_READONLY
else:
style = 0
return wx.TextCtrl(self, style=style)
def _createButton(self):
bitmap = wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, client=wx.ART_BUTTON)
return wx.BitmapButton(self, bitmap=bitmap)
def _layoutInterior(self):
panelSizer = wx.BoxSizer(wx.HORIZONTAL)
panelSizer.Add(self._text, flag=wx.EXPAND, proportion=1)
panelSizer.Add(self._button)
self.SetSizerAndFit(panelSizer)