I have a little project im working on, and the fundamentals are fine, i just have two specific queries. I have learned the code shown here from scratch the past week from samples and tutorials plus a little outside the box thinking.
My only problem now is that my two queries are too specific for me to find in a search engine or guide.
problem 1: I need the static text title to fill the full proportion of the slot it is in, sort of half the vertical size of the button but just as wide. I would also like advice on how to put a picture or logo in place of the text.
problem 2: I need to know how to drop a line when putting text on a button, ive tried /n //n //N but it always comes up as part of the string.
i would greatly appreciate advice on both these problems and any comments/criticisms about my layout ect.
Thanks.
import wx
class Sample(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self, parent, id, 'Sample Code', size = (250, 350))
panel1 = wx.Panel(self)
title = wx.StaticText(panel1, wx.ALIGN_CENTRE, "HUGE CENTRED TITLE")
rndmbtn = wx.Button(panel1, label = "Random //n Button")
vrtspc1 = wx.BoxSizer(wx.VERTICAL)
vrtspc2 = wx.BoxSizer(wx.VERTICAL)
hzlspc1 = wx.BoxSizer()
hzlspc2 = wx.BoxSizer()
hzlspc3 = wx.BoxSizer()
vertbox2 = wx.BoxSizer(wx.VERTICAL)
vertbox2.Add(hzlspc1, proportion = 1, border = 0)
vertbox2.Add(title, proportion = 2, flag = wx.EXPAND, border = 0)
vertbox2.Add(hzlspc2, proportion = 1, border = 0)
vertbox2.Add(rndmbtn, proportion = 4, flag = wx.EXPAND, border = 0)
vertbox2.Add(hzlspc3, proportion = 1, border = 0)
layoutmgr = wx.BoxSizer()
layoutmgr.Add(vrtspc1, proportion = 1, border = 0)
layoutmgr.Add(vertbox2, proportion = 5, flag = wx.EXPAND, border = 0)
layoutmgr.Add(vrtspc2, proportion = 1, border = 0)
panel1.SetSizer(layoutmgr)
app = wx.App(redirect = False)
frame = Sample(parent = None, id = -1)
frame.Show()
app.MainLoop()