ANN: ComboTreeBox v0.6 (was Re: ANN: ComboTreeBox v0.5)

Robin Dunn:

Frank Niessink wrote:

Robin Dunn:

I think it's getting close. Some more detail in the docstrings would be nice, and also splitting out the demo so it can be put into the wxPython demo.

There are some differences across platforms with regard to key events. Some of these may be limitations of the platforms, but it would be nice to find workarounds if possible. On wxGTK the down-arrow will open the drop down box, and then will navigate the tree. On wxMSW the up/down arrows don't do anything in the text field, but once the tree has been dropped down the arrows can be used to navigate the tree. On wxMac the up/down arrows don't do anything at all (It acts like the treectrl is not getting the focus at all, except it paints the selected item as if it does have the focus.) Also, on wxMSW an F4 will cause an empty drop down box to open. (This key is used by the native combobox to trigger the dropdown.)

Thanks, I'll look into those issues.

And I did. I closely observed the behavior of the native Combobox on wxMSW, wxMac and wxGTK (as shown in the wxPython demo) and tried to mimic it as closely as possible with ComboTreeBox. I had a few issues though:
- I use a Windows keyboard with my Mac Mini and I think that some key codes get mixed up, e.g. I can't navigate any wxPython TreeCtrl with up and down, not even in the wxPython demo. Could someone please confirm that the popped up tree can be navigated with the keyboard on wxMac?
- It seems that the Combobox widget used by wxPython on wxMac is not native. Is that correct? The wxPython Combobox differs slightly from the 'real' native Combobox as present in Interface Builder for example, so I wasn't entirely sure which one to use as ultimate reference.
- On wxGTK, the popped up frame with the TreeCtrl seems to be a bit too big for the TreeCtrl, showing a small unused part at the top. What can I do about that?

I haven't come around to splitting up the one file into parts for the ComboTreeBox itself, the tests, and the demo, yet. I'll do that in next version.

* About ComboTreeBox

ComboTreeBox is a ComboBox that pops up a tree to pick an item from,
instead of a list.

You can run the unittests like this: python test
You can run the demo like this: python demo

You can force a specific implementation to demo or test by adding 'MSW', 'GTK' or 'MAC', e.g. "python demo GTK" will run the GTK implementation even when on Windows or Mac.

Cheers, Frank (41.4 KB)

hi, i am using the comboTreeBox inside a popup dialog, but when I clicked the green arrow, the treeCtrl did not attached to the comboTreeBox but independently outside the mainPanel.
And I am working this on MAC 10.15.7, python3.8, pycharm community
self.cateI = ComboTreeBox(panel, style=wx.CB_READONLY)
self.cateI.Append(‘Item 01’)

I’m sorry, but I haven’t been using wxPython or ComboTreeBox for a long time so I can’t help you with this.

Cheers, Frank