wxpython框没有在Windows上显示

时间:2014-02-14 15:04:06

标签: python checkbox drag-and-drop wxpython

我有以下代码在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)

1 个答案:

答案 0 :(得分:0)

更改了以下行以添加.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))