wxPython入门第五课--statictext

我参考的的是youtu上的视频教程 ,这个仅仅作为一个个人的学习笔记作为参考

https://www.youtube.com/watch?v=8v52QIP4L9Y&list=PLejTrt5hn2r1uzZ53GDeUElXRkRFbUmQd&index=3

上面就是链接 

import wx
class bucky(wx.Frame):      

    #结构函数,这样就没必要每次都要单独执行一下
    def __init__(self,parent,id):  
        wx.Frame.__init__(self,parent,id,'Frame aka window',size=(300,200))
   
        #making a  panel
        panel=wx.Panel(self)   # self

        wx.StaticText(panel,-1,'This is statice text',(50,50))

        custom=wx.StaticText(panel,-1,'This is custom',(10,30),(260,-1),wx.ALIGN_CENTER)
                                                                # 这个是allign 也是可以设置成右面的对面

        custom.SetForegroundColour('white')
        custom.SetBackgroundColour('blue')

        

 
      
if __name__=='__main__':
    app=wx.App()
    frame=bucky(parent=None,id=-1)
    frame.Show()
    app.MainLoop()   #这个是用来执行这个 alpplication 的   

猜你喜欢

转载自blog.csdn.net/weixin_42066185/article/details/81173774