求助,最近在学wxPython,然后运行之后界面出现遮挡,系统是Win10 64位操作系统
PS:我在win7系统运行就没有任何问题
代码如下:
import wx
class MyFrame(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id,title='测试',pos=(100,100),size=(400,300))
panel = wx.Panel(self)
# 创建文本
self.title = wx.StaticText(panel,label='请输入用户名和密码') # 提示语
self.label_user = wx.StaticText(panel,label='用户名:') # 用户名
self.label_pwd = wx.StaticText(panel,label='密 码:') # 密码
# 创建输入框
self.text_user = wx.TextCtrl(panel)
self.text_pwd = wx.TextCtrl(panel,style=wx.TE_PASSWORD)
# 创建按钮
self.confirm = wx.Button(panel,label='确认')
self.cancel = wx.Button(panel,label='取消')
# 创建横向容器 用户名
hsizer_user = wx.BoxSizer(wx.HORIZONTAL)
hsizer_user.Add(self.label_user,proportion=0,flag=wx.ALL,border=5)
hsizer_user.Add(self.text_user,proportion=0,flag=wx.ALL,border=5)
# 创建横向容器 密码
hsizer_pwd = wx.BoxSizer(wx.HORIZONTAL)
hsizer_pwd.Add(self.label_pwd,proportion=0,flag=wx.ALL,border=5)
hsizer_pwd.Add(self.text_pwd,proportion=0,flag=wx.ALL,border=5)
# 创建横向容器 按钮
hsizer_button = wx.BoxSizer(wx.HORIZONTAL)
hsizer_button.Add(self.confirm,proportion=0,flag=wx.ALL,border=5)
hsizer_button.Add(self.cancel,proportion=0,flag=wx.ALL,border=5)
# 创建纵向容器 ALL
vsizer_all = wx.BoxSizer(wx.VERTICAL)
vsizer_all.Add(self.title,proportion=0,flag=wx.TOP|wx.BOTTOM|wx.CENTER,border=15) # 提示语
vsizer_all.Add(hsizer_user,proportion=0,flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=45) # 用户名
vsizer_all.Add(hsizer_pwd,proportion=0,flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=45) #密码
vsizer_all.Add(hsizer_button,proportion=0,flag=wx.ALIGN_CENTER|wx.TOP,border=15)
panel.SetSizer(vsizer_all)
if __name__ == '__main__':
app = wx.App()
myframe = MyFrame(None,-1)
myframe.Show()
app.MainLoop()