Python Forum
[WxPython] How to create a static white box text
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[WxPython] How to create a static white box text
#1
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
Reply
#2
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
Reply
#3
what do you mean by white box? (widget name)
You posted answer while I was posting question, disregard
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I'm trying to visualize neuron weights with PIL but getting a white image. pointdexter16 0 82 Apr-13-2024, 02:48 PM
Last Post: pointdexter16
  [Tkinter] White edge sdgdfgg 4 774 Dec-14-2023, 04:48 AM
Last Post: reneejenkins
  [Kivy] Create a function to store text fields and drop downs selection in KivyMD floxia 0 1,649 Dec-18-2022, 04:34 AM
Last Post: floxia
  What should I do the character comes to the door the background changes in to white. Killdoz 0 1,330 May-22-2020, 02:41 PM
Last Post: Killdoz
  Deleting White from Bitmap Anysja 8 5,497 Aug-14-2018, 04:04 PM
Last Post: Anysja

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020