I'm using a wxDialog for changing some parameters in my application and I have some problems:
1. The layout is not like I want.
I think it's a problem with the sizers and very simple to solve but I prefer someone which would use it more than me to explain how to solve the problem.
Here is the code:
class SystemConfigureDialog(wx.Dialog):
def __init__(self, parent, ID, title, system):
wx.Dialog.__init__(self, parent, ID, title)
ID_CODE = wx.NewId()
self.system = system
# Set Controls
label_name = wx.StaticText(self, -1, "Name: ")
self.name = wx.TextCtrl(self, -1, system.name)
label_sysfile = wx.StaticText(self, -1, "System file: ")
self.sysfile = wx.TextCtrl(self, -1, system.sysfile)
button_sysfile = wx.Button(self, ID_CODE, "View Code")
label_sysname = wx.StaticText(self, -1, "System name: ")
self.sysname = wx.TextCtrl(self, -1, system.sysname)
line = wx.StaticLine(self, -1)
buttonOK = wx.Button(self, wx.ID_OK, "OK")
buttonOK.SetDefault()
buttonCancel = wx.Button(self, wx.ID_CANCEL, "Cancel")
# Do Layout
sizer = wx.BoxSizer(wx.VERTICAL)
box1 = wx.BoxSizer(wx.HORIZONTAL)
box1.Add(label_name, 0, wx.LEFT, 5)
box1.Add(self.name, 1, wx.ALIGN_CENTER, 5)
sizer.Add(box1, 0, wx.EXPAND|wx.ALL, 5)
box5 = wx.BoxSizer(wx.HORIZONTAL)
box5.Add(label_sysfile, 0, wx.LEFT, 5)
box5.Add(self.sysfile, 1, wx.ALIGN_CENTER, 5)
box5.Add(button_sysfile, 0, wx.ALIGN_CENTER, 5)
sizer.Add(box5, 0, wx.EXPAND|wx.ALL, 5)
box6 = wx.BoxSizer(wx.HORIZONTAL)
box6.Add(label_sysname, 0, wx.LEFT, 5)
box6.Add(self.sysname, 1, wx.ALIGN_CENTER, 5)
sizer.Add(box6, 0, wx.EXPAND|wx.ALL, 5)
sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
box7 = wx.BoxSizer(wx.HORIZONTAL)
box7.Add(buttonOK, 0, wx.ALIGN_CENTER|wx.ALL, 5)
box7.Add(buttonCancel, 0, wx.ALIGN_CENTER|wx.ALL, 5)
sizer.Add(box7, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
self.SetSizer(sizer)
self.SetAutoLayout(True)
sizer.Fit(self)
The things appear with no order. I want like a table with labels on the left, and textctrls on the right.
I want the buttons centered if possible (for sure possible), too.
Thnaks.
David Asensio Ortega
P.D. More problems in the next mail
···
_________________________________________________________________
Horóscopo, tarot, numerologÃa... Escucha lo que te dicen los astros. http://astrocentro.msn.es/