EDIT: (I knew that the labels needed fixing)
And have a look at …\demo\SizedControls.py
G’day and greetings from up above,
Thom
import wx
from wx.lib import sized_controls
class CustomDialog(sized_controls.SizedFrame):
def __init__(self, *args, **kwargs):
super(CustomDialog, self).__init__(*args, **kwargs)
self.SetBackgroundColour('#221630')
pane = self.GetContentsPane()
pane.SetSizerType("grid", {"cols":3}) # 3-column grid layout
# row 1
stt1 = wx.StaticText(pane, wx.ID_ANY, 'File:')
stt1.SetForegroundColour('#ffffff')
stt1.SetSizerProps(halign='right', valign='centre', border=('all', 5))
txc1 = wx.TextCtrl(pane, wx.ID_ANY, '', size=(-1, -1))
txc1.SetSizerProps(valign='centre', expand=True, border=('all', 5))
btn1 = wx.Button(pane, wx.ID_ANY, label='Browse')
# row 2
stt2 = wx.StaticText(pane, wx.ID_ANY, 'Password:')
stt2.SetSizerProps(halign='right', valign='centre', border=('all', 5))
stt2.SetForegroundColour('#ffffff')
txc2 = wx.TextCtrl(pane, wx.ID_ANY, '', size=(-1, -1))
txc2.SetSizerProps(valign='centre', expand=True, border=('all', 5))
wx.StaticText(pane, wx.ID_ANY, '') # dummy filler
# row 3
btn2 = wx.Button(pane, wx.ID_ANY, label='Encrypt')
btn2.SetBackgroundColour('#50104b')
btn2.SetForegroundColour('#ffffff')
btn3 = wx.Button(pane, wx.ID_ANY, label='Cancel')
btn3.SetBackgroundColour('#50104b')
btn3.SetForegroundColour('#ffffff')
self.Fit()
if __name__ == '__main__':
app = wx.App(False)
dlg = CustomDialog(None, title='Decrypt File (Custom Dialog)', style=wx.CAPTION | wx.RESIZE_BORDER | wx.CLOSE_BOX)
res = dlg.Show()
app.MainLoop()