wx.StaticBox text cut off

Hello everyone,

I am trying to use a static box w/ a guage, and I can't get the static box's text to display completely, it is cut off on the right side. I tried changing it's size but that doesn't help. Does anyone know what am I missing?

        # ....
        battStaticBox = wx.StaticBox(panel, id=wx.ID_ANY, label="Battery",
                                    pos=wx.DefaultPosition, size=wx.DefaultSize,
                                    style=0)
        batterySizer = wx.StaticBoxSizer(battStaticBox, wx.VERTICAL)
        self.batteryGuage = wx.Gauge(panel, id=wx.ID_ANY, range=100,
                                     size=(30, 255), style=wx.GA_VERTICAL)
        batterySizer.Add(self.batteryGuage, flag=wx.CENTER)
        self.battStaticText = wx.StaticText(panel, id=wx.ID_ANY, label="0 %",
                                           pos=wx.DefaultPosition, size=wx.DefaultSize,
                                           style=wx.ALIGN_CENTRE)
        batterySizer.Add(self.battStaticText, flag=wx.CENTER)
        mainSizer.AddSizer(batterySizer, flag=wx.BOTTOM|wx.LEFT|wx.RIGHT, border=5)

Thank you,
Gabriel

Gabriel Rossetti wrote:

Hello everyone,

I am trying to use a static box w/ a guage, and I can't get the static box's text to display completely, it is cut off on the right side. I tried changing it's size but that doesn't help. Does anyone know what am I missing?

       # ....
       battStaticBox = wx.StaticBox(panel, id=wx.ID_ANY, label="Battery",
                                   pos=wx.DefaultPosition, size=wx.DefaultSize,
                                   style=0)
       batterySizer = wx.StaticBoxSizer(battStaticBox, wx.VERTICAL)
       self.batteryGuage = wx.Gauge(panel, id=wx.ID_ANY, range=100,
                                    size=(30, 255), style=wx.GA_VERTICAL)
       batterySizer.Add(self.batteryGuage, flag=wx.CENTER)
       self.battStaticText = wx.StaticText(panel, id=wx.ID_ANY, label="0 %",
                                          pos=wx.DefaultPosition, size=wx.DefaultSize,
                                          style=wx.ALIGN_CENTRE)
       batterySizer.Add(self.battStaticText, flag=wx.CENTER)
       mainSizer.AddSizer(batterySizer, flag=wx.BOTTOM|wx.LEFT|wx.RIGHT, border=5)

Thank you,
Gabriel
___________________

I've only used this widget once, but I think it sizes itself to its children. Just make the size of the gauge (40,255) instead.

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

Gabriel Rossetti wrote:

Hello everyone,

I am trying to use a static box w/ a guage, and I can't get the static box's text to display completely, it is cut off on the right side. I tried changing it's size but that doesn't help. Does anyone know what am I missing?

       batterySizer.Add(self.battStaticText, flag=wx.CENTER)

Try wx.ALIGN_CENTER instead of wx.CENTER

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Gabriel Rossetti wrote:

Hello everyone,

I am trying to use a static box w/ a guage, and I can't get the static box's text to display completely, it is cut off on the right side. I tried changing it's size but that doesn't help. Does anyone know what am I missing?

       batterySizer.Add(self.battStaticText, flag=wx.CENTER)

Try wx.ALIGN_CENTER instead of wx.CENTER

Nope, that didn't help...

Mike Driscoll wrote:

Gabriel Rossetti wrote:

Hello everyone,

I am trying to use a static box w/ a guage, and I can't get the static box's text to display completely, it is cut off on the right side. I tried changing it's size but that doesn't help. Does anyone know what am I missing?

       # ....
       battStaticBox = wx.StaticBox(panel, id=wx.ID_ANY, label="Battery",
                                   pos=wx.DefaultPosition, size=wx.DefaultSize,
                                   style=0)
       batterySizer = wx.StaticBoxSizer(battStaticBox, wx.VERTICAL)
       self.batteryGuage = wx.Gauge(panel, id=wx.ID_ANY, range=100,
                                    size=(30, 255), style=wx.GA_VERTICAL)
       batterySizer.Add(self.batteryGuage, flag=wx.CENTER)
       self.battStaticText = wx.StaticText(panel, id=wx.ID_ANY, label="0 %",
                                          pos=wx.DefaultPosition, size=wx.DefaultSize,
                                          style=wx.ALIGN_CENTRE)
       batterySizer.Add(self.battStaticText, flag=wx.CENTER)
       mainSizer.AddSizer(batterySizer, flag=wx.BOTTOM|wx.LEFT|wx.RIGHT, border=5)

Thank you,
Gabriel
___________________

I've only used this widget once, but I think it sizes itself to its children. Just make the size of the gauge (40,255) instead.

-------------------
Mike Driscoll

I really want the guage to keep it's current size. I found that I can force it's minimum size (SetMinSize), as normally it gets that from the guage (as you said).

Gabriel