Opened 5 years ago

Closed 4 years ago

#17649 closed defect (invalid)

wx.DatePickerCtrl's GetChildren() call returns inconsistent wrapped type

Reported by: will133 Owned by:
Priority: normal Milestone:
Component: wxPython Version: 3.0.2
Keywords: Cc:
Blocked By: Blocking:
Patch: no


This is related to a ticket I filed at:

but since I think it may be a wxPython bug I'm filing it here as well.


I'm running wxPython gtk2 (classic) on Linux.

To reproduce:

Trying to execute this following code:

import wx._combo
import wx

class Frame(wx.Frame):
    def __init__(self, title):
        wx.Frame.__init__(self, None, title=title, pos=(150, 150), size=(350, 200))
        panel = wx.Panel(self)
        box = wx.BoxSizer(wx.VERTICAL)
        dateCtrl = wx.DatePickerCtrl(panel,
                                     size=(120, -1),
                                     | wx.DP_SHOWCENTURY
                                     | wx.DP_ALLOWNONE)
        box.Add(dateCtrl, 0, wx.ALL, 50)

if __name__ == "__main__":
    app = wx.App()   # Error messages go to popup window
    top = Frame("test")

will yield this:

wxWindowList: [<Swig Object of type 'wxComboCtrl *' at 0x22d6400>]

The behavior, however, is different when *I comment out the wx._combo line*. If I rerun that code I'd get:

wxWindowList: [<wx._core.Control; proxy of <Swig Object of type 'wxControl *' at 0x26dc000> >]

Note that originally I was not importing wx._combo but wx.combo, which import the _combo from that module.

It seems the behavior is really strange and made the traitsui package that I've been using failed in unpredictable ways. The second behavior is the expected one, I assume.

Change History (1)

comment:1 Changed 4 years ago by robind

  • Resolution set to invalid
  • Status changed from new to closed

This is expected and not a bug. The runtime type info implemented for the C++ classes is not loaded in a way that wxPython can use until the wxPython extension module implementing those classes is imported, so what you are seeing is just a side-effect of that implementation detail.

Either way, that is handled differently now in wxPython 4.

Note: See TracTickets for help on using tickets.