窗口上不显示wxpython框

2024-09-30 22:26:46 发布

您现在位置:Python中文网/ 问答频道 /正文

下面的代码在MAC上运行得很好,但是在Windows上运行时,复选框不会选中,拖放窗口也不会显示。你知道为什么吗?你知道吗

def verify(self, event):

    self.Show()

    cb1 = wx.CheckBox(self, pos=(112, 36))
    cb1.SetValue(False)
    cb1.Bind(wx.EVT_CHECKBOX, self.ShowOrHideTVTitle)

    self.txtTitle = wx.TextCtrl(self.panel1,-1,pos=(132, 0), size=(215, 25), style= wx.SUNKEN_BORDER, value="Enter Series Title Here")
    self.txtTitle.Show(False)
    global showBox1
    showBox1 = 0

    dt1 = MyFileDropTarget(self)
    self.tc_files = wx.TextCtrl(self, wx.ID_ANY, pos=(42, 93), size=(500, 25))
    self.tc_files.SetDropTarget(dt1)

    self.buttonGo = wx.Button(self.panel1, -1, "Verify", pos=(440,100))
    self.buttonGo.Bind(wx.EVT_BUTTON, self.go1)

    self.buttonClose = wx.Button(self.panel1, -1, "Quit", pos=(25,100))
    self.buttonClose.Bind(wx.EVT_BUTTON, self.OnClose)

    global log
    log = wx.TextCtrl(self.panel1, -1, pos=(35, 160), size=(720,450),
                          style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL)

    self.redir=RedirectText(log)
    sys.stdout=self.redir

    outputtxt1 = '''TV Series'''
    wx.StaticText(self.panel1, -1, outputtxt1, (33, 2), style=wx.ALIGN_CENTRE)

    outputtxt3 = '''Drag & Drop Folder of Packages to Verify'''
    wx.StaticText(self.panel1, -1, outputtxt3, (33, 40), style=wx.ALIGN_CENTRE)

    outputtxt4 = '''Log Window'''
    wx.StaticText(self.panel1, -1, outputtxt4, (33, 138), style=wx.ALIGN_CENTRE)

def notify(self, indir):
    """Update file in testcontrol after drag and drop"""
    self.tc_files.SetValue(indir[0])
    global indir1
    indir1 = '\n'.join(indir)
    global indir2
    indir2 = indir1.replace(' ', escape)

def ShowOrHideTVTitle(self, e):   
    sender1 = e.GetEventObject()
    isChecked = sender1.GetValue()
    global showBox1
    if showBox1 == 0:
        showBox1 = 1
        self.txtTitle.Show(True)
    else:
        showBox1 = 0
        self.txtTitle.Show(False)

Tags: posselffalsebindstyledefshowglobal
1条回答
网友
1楼 · 发布于 2024-09-30 22:26:46

将下面的行更改为add.panel1,一切正常。你知道吗

cb1 = wx.CheckBox(self.panel1, pos=(112, 36))


self.tc_files = wx.TextCtrl(self.panel1, wx.ID_ANY, pos=(42, 93), size=(500, 25))

相关问题 更多 >