FilePicker display

  • Jeff Graver

    Jeff Graver - 2008-10-29

    Under Windows, I am finding that the FilePicker button seems difficult to control.  I have observed the following:

    First, (and most trivially) When selecting a FilePicker button during a designer session, I get a "Boa Information" box reporting, "Error on accessing Getter for ToolTipString: 'NoneType' object has no attribute 'Get Tip'".

    Next, when I put a FilePicker button on an other wise blank frame, the text ctrl will expand in width, and the button in width and height to fill the frame, which seems to be correct according to the help file.

    However, if the FilePicker button is put on a panel, or in a sizer, or if it even shares the frame with another control or two, it doesn't draw properly.  The button seems to appear beneath the text ctrl.

    I have been able to get the FilePicker to display appropriately by putting it on a panel that is itself on a sizer, but even then, the widget will not display at all until the Frame is resized.  I have tried calling the Refersh() function for both the FilePicker and the enclosing frame to see if I can get a redraw to happen automatically, but no luck.

    Are these known shortcomings?  Something to report to wx discussion groups?  The result of something stupid that I'm doing?  I'm not sure where to begin here.

    Code (representing best effort so far) to follow.

    Thanks in advance,



    import wx

    def create(parent):
        return Frame1(parent)

    ] = [wx.NewId() for _init_ctrls in range(4)]

    class Frame1(wx.Frame):
        def _init_coll_boxSizer1_Items(self, parent):
            # generated method, don't edit

            parent.AddWindow(self.panel1, 0, border=0, flag=wx.EXPAND | wx.ALL)
            parent.AddWindow(self.panel2, 1, border=0, flag=wx.EXPAND | wx.ALL)

        def _init_coll_boxSizer2_Items(self, parent):
            # generated method, don't edit

            parent.AddWindow(self.filePickerCtrl1, 0, border=0,
                  flag=wx.ALL | wx.EXPAND)

        def _init_sizers(self):
            # generated method, don't edit
            self.boxSizer1 = wx.BoxSizer(orient=wx.VERTICAL)

            self.boxSizer2 = wx.BoxSizer(orient=wx.VERTICAL)



        def _init_ctrls(self, prnt):
            # generated method, don't edit
            wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
                  pos=wx.Point(515, 323), size=wx.Size(400, 250),
                  style=wx.DEFAULT_FRAME_STYLE, title='Frame1')
            self.SetClientSize(wx.Size(392, 223))

            self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1, name='panel1', parent=self,
                  pos=wx.Point(0, 0), size=wx.Size(392, 30),
                  style=wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL)
            self.panel1.SetMinSize(wx.Size(392, 30))

            self.panel2 = wx.Panel(id=wxID_FRAME1PANEL2, name='panel2', parent=self,
                  pos=wx.Point(0, 30), size=wx.Size(392, 193),
                  style=wx.RAISED_BORDER | wx.TAB_TRAVERSAL)

            self.filePickerCtrl1 = wx.FilePickerCtrl(id=wxID_FRAME1FILEPICKERCTRL1,
                  message='Select a folder', name='filePickerCtrl1',
                  parent=self.panel1, path='', pos=wx.Point(0, 0), size=wx.Size(388,
                  23), style=wx.DIRP_DEFAULT_STYLE, wildcard='*.*')


        def __init__(self, parent):

    if __name__ == '__main__':
        app = wx.PySimpleApp()
        frame = create(None)


    • Riaan Booysen

      Riaan Booysen - 2008-11-06

      Hi Jeff,

      I'll try to improve the behaviour of the FilePicker in Boa before the next release, but some of the behaviour is inherent in the control and Boa can't change that.


    • Riaan Booysen

      Riaan Booysen - 2008-11-06

      Hi Jeff,

      I had a look at all the picker controls. It seems their behavior has changed in a recent release of wxPython.

      The Control.GetTip() method now returns None. I've suppressed the ToolTipString property
      for them in Boa. You may just ignore the error pop-up for now, it doesn't affect the code generation.

      The other wxPython change that now displays the controls wrong can be worked around by calling Control.Layout() in your code.



Log in to post a comment.