Greetings developers!
I'm in a pickle and can't figure out how to get around this problem...
Here is a complete test case of code -
import os, sys, wx
-
-
class MainPanel(wx.Panel):
-
def __init__(self,parent):
-
wx.Panel.__init__(self, parent, -1)
-
#self.SetBackgroundColour(wx.Color(185,185,185))
-
-
box = wx.StaticBox(self, -1, "Digital Dashboard")
-
bxsizer = wx.StaticBoxSizer(box, wx.VERTICAL)
-
trsizer = wx.BoxSizer(wx.HORIZONTAL)
-
brsizer = wx.BoxSizer(wx.HORIZONTAL)
-
-
# This will be the top row of information
-
# Operator Information Box
-
op_box = wx.StaticBox(self, -1, "Operator")
-
trsizer.Add(op_box, 1, wx.EXPAND | wx.ALL, 5)
-
op_box_szr = wx.StaticBoxSizer(op_box, wx.VERTICAL)
-
##########################################################
-
# This text box will not get placed in the staticboxsizer... I've even
-
# tried putting a panel on the op_box_szr and giving that a sizer
-
# and then placing the text in THAT sizer with no luck.
-
self.dir = wx.StaticText(self, -1, 'Speed')
-
op_box_szr.Add(self.dir, 1, wx.EXPAND|wx.ALL, 2)
-
##########################################################
-
# Traction Information Box
-
trac_box = wx.StaticBox(self, -1, "Traction")
-
trsizer.Add(trac_box, 1, wx.EXPAND | wx.ALL, 5)
-
trac_box_szr = wx.StaticBoxSizer(trac_box, wx.VERTICAL)
-
# Motor Information Box
-
tm_box = wx.StaticBox(self, -1, "Motors")
-
trsizer.Add(tm_box, 1, wx.EXPAND | wx.ALL, 5)
-
tm_box_szr = wx.StaticBoxSizer(tm_box, wx.VERTICAL)
-
-
# This will be the bottom row of information
-
# Trip Stats Information Box
-
stats_box = wx.StaticBox(self, -1, "Trip Stats")
-
brsizer.Add(stats_box, 1, wx.EXPAND | wx.ALL, 5)
-
stats_box_szr = wx.StaticBoxSizer(stats_box, wx.VERTICAL)
-
# Auxilary Information Box
-
aux_box = wx.StaticBox(self, -1, "Auxilary Info")
-
brsizer.Add(aux_box, 1, wx.EXPAND | wx.ALL, 5)
-
aux_box_szr = wx.StaticBoxSizer(aux_box, wx.VERTICAL)
-
-
bxsizer.Add(trsizer, 1, wx.EXPAND | wx.ALL, 5)
-
bxsizer.Add(brsizer, 1, wx.EXPAND | wx.ALL, 5)
-
-
border = wx.BoxSizer()
-
border.Add(bxsizer, 1, wx.EXPAND|wx.ALL, 5)
-
self.SetSizer(border)
-
-
-
class MainWindow(wx.Frame):
-
def __init__(self, *args, **kwargs):
-
wx.Frame.__init__(self, *args, **kwargs)
-
-
self.sb = self.CreateStatusBar(2)
-
self.sb.SetStatusWidths([-2, -1])
-
-
# Set up the window layout controller
-
self.sizer = wx.BoxSizer(wx.VERTICAL)
-
self.SetSizer(self.sizer)
-
-
self.main_panel = MainPanel(self)
-
self.sizer.Add(self.main_panel, 5, wx.EXPAND | wx.ALL)
-
-
# Set up a log on the main window
-
self.userLog = wx.TextCtrl(self, -1,
-
style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL)
-
self.sizer.Add(self.userLog, 1, wx.LEFT | wx.TOP | wx.GROW)
-
-
# Set up a connection status tool bar on the bottom of the window
-
self.cs = wx.Panel(self, -1, style = wx.NO_FULL_REPAINT_ON_RESIZE)
-
self.conn_stat = wx.StaticText(self.cs, -1, " Disconnected")
-
self.sizer.Add(self.cs, 0, wx.LEFT | wx.GROW)
-
-
self.Bind(wx.EVT_CLOSE, self.exitApp)
-
-
-
def exitApp(self,event=None):
-
self.Destroy()
-
-
-
if __name__ == '__main__':
-
myapp = wx.App(redirect=False)
-
-
myframe = MainWindow(None, title = 'Digital Dashboard', size=(1000, 800))
-
myframe.Show()
-
myapp.MainLoop()
-
So all I'm tring to do is put a couple of stats in each of these "sub" boxes but I seem to be unable to do that since box's children are really their siblings (can you tell it's my first time working with wx.StaticBox)... I don't know, I'm confused and would appreciate any help.
Regards,
James
2 3691
Note: I don't know if I made it clear or not, but the static text within that 'sub' box displays in the upper left hand corner of the main window object :(
Woops! I just needed to add the StaticBoxSizers of each static box to my trsizer and brsizer accordingly (instead of the static box itself).
That was a good learning experience of how to do layouts with multiple static boxes!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Glen |
last post by:
I have a Struts action form which contains a bean. I am trying to
display a bean retrieved from the database in this form using the
nested tag. Can anyone help me? I continue to get an error...
|
by: Andy Baker |
last post by:
Hi there,
I'm learning Python at the moment and trying to grok the thinking behind
it's scoping and nesting rules.
I was googling for nested functions and found this Guido quote:...
|
by: Erik Bongers |
last post by:
Hi,
Nested classes only seem to be able to access static members of the
surrounding class :
class SurroundingClass
{
public:
class InnerClass
{
public:
|
by: B0nj |
last post by:
I've got a class in which I want to implement a property
that operates like an indexer, for the various colors
associated with the class.
For instance, I want to be able to do 'set' operations...
|
by: Robert W. |
last post by:
I've almost completed building a Model-View-Controller but have run into a
snag. When an event is fired on a form control I want to automatically
updated the "connnected" property in the Model. ...
|
by: Tomas Sieger |
last post by:
Hi all,
I'm in doubt with the following code:
class Base {
public:
class Nested {};
};
class Derived:public Base {
public:
class Nested {
|
by: Peter Olcott |
last post by:
http://www.tommti-systems.de/go.html?http://www.tommti-systems.de/main-Dateien/reviews/languages/benchmarks.html
The above link shows that C# is 450% slower on something as simple as a nested
loop....
|
by: jdurancomas |
last post by:
Dear all,
I'm trying to declare the operator++ to a nested class. The nested
class is not template but the container it is.
The code used in teh sample program is included bellow:
...
|
by: sarabhjeet |
last post by:
I need to put a StaticBox,how to put it in existing design.Just write the whole example syntax with real world values.
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |