I was trying to create a simple Python GUI with a label on a frame. I can't get the label's position and size to work:
# a simple wxPython GUI program
# showing a label with color text
# however, label position and size do not work!
import wx
class MyFrame(wx.Frame):
def __init__(self, parent, mytitle, mysize):
wx.Frame.__init__(self, parent, -1, mytitle, size=mysize)
self.SetBackgroundColour("white")
s = "Red letters on a yellow background"
label = wx.StaticText(self, -1, label=s, pos=(20, 100), size=(200, 30))
# set fg and bg color of label
label.SetForegroundColour("red")
label.SetBackgroundColour("yellow")
app = wx.App(redirect=True)
# create a frame of given size = (width, height)
title = "color label"
frame = MyFrame(None, title, (400, 240))
frame.Show(True)
app.MainLoop()