新人求助:wxpython在带有背景图的框架上显示静态文本

图片说明

运行结果中的静态文本背景色我设为了蓝色,我希望不显示其背景色,希望有大神解答,非常感谢
class MyPanel(wx.Panel):

def init(self, parent, id):

wx.Panel.__init__(self, parent, id)

try:

image_file = 'background.jpg'

to_bmp_image = wx.Image(image_file, wx.BITMAP_TYPE_ANY).ConvertToBitmap()

self.bitmap = wx.StaticBitmap(self, -1, to_bmp_image, (0, 0))

image_width = to_bmp_image.GetWidth()

image_height = to_bmp_image.GetHeight()

set_title = '%s %d x %d' % (image_file, to_bmp_image.GetWidth(), to_bmp_image.GetHeight())

parent.SetTitle(set_title)

except IOError:

print('Image file %s not found' % image_file)

raise SystemExit

    self.button = wx.Button(self.bitmap, -1, label='Test', pos=(10,10))
    st_tips = wx.StaticText(self ,0,u"sspu 停车管理系统",pos=(10,50))
    st_tips.SetForegroundColour('white')
    st_tips.SetBackgroundColour('blue')

if name == '__main__':

app = wx.PySimpleApp()

frame = wx.Frame(None, -1, 'Image', size=(300,300))

my_panel = MyPanel(frame, -1)

frame.Show()

app.MainLoop()
del app


查看全部
weixin_41299704
回锅肉盖浇面
2019/04/20 16:30
  • python
  • 点赞
  • 收藏
  • 回答
    私信

0个回复