Python Forum

Full Version: How to create a static white box text
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I need to create a very simple box to show the path of a file. The application will show, at start up, in the same row (i will use boxSizer(horizontal), a white box empty and a "browse" button. Then i need to update the text in the box with the path after chosing the path.

I am using a static text field but it takes the size of the text, therefore at start up is empty, no box is shown. I need the box to always be shown, with white background.

Thanks
This looks like it worked!

box_horiz = wx.BoxSizer(wx.HORIZONTAL)
        self.textPath = wx.StaticText(panel, label="hello", style=wx.TE_READONLY|wx.BORDER_SUNKEN)
        self.textPath.SetBackgroundColour((255,255,255)) 
        self.btnPath = wx.Button(panel,-1,"Path")

        box_horiz.Add(self.textPath,10,wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL|wx.ALL,5)
        box_horiz.Add(self.btnPath,3,wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL|wx.ALL,5)
I'll be happy to see if there is any other better way to do this. Thanks
what do you mean by white box? (widget name)
You posted answer while I was posting question, disregard