我正在尝试将用python3编写的代码更改为python2.4。 Python3版本代码在窗口上运行良好,但在python2.4和Centos5.11中,即使运行相同的代码,GUI也不相同。
窗口中的
,python3
in centos,python2.4
gui代码如下:
class Panel(wx.Panel):
global WTIME
def __init__(self, parent, site):
wx.Panel.__init__(self, parent,wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(600,100), style=wx.TAB_TRAVERSAL)
self.site = site
bSizer = wx.BoxSizer(wx.VERTICAL)
self.canvas = PlotCanvas(self, 0)
self.canvas.SetYSpec("none")
self.canvas.Draw(drawBarGraph(self.site), xAxis=(0,12), yAxis=(0,1))
bSizer.Add(self.canvas, 1, wx.EXPAND)
self.SetSizer(bSizer)
self.canvas.SetEnableGrid(False)
self.Layout()
def updateGraph(self, site_log):
self.canvas.Draw(drawBarGraph(self.site, site_log), xAxis=(0,WTIME), yAxis=(0,1))
class MainFrame(wx.Frame):
def __init__(self):
"""Constructor"""
wx.Frame.__init__(self, None, title="NoName", size=(1250,500))
self.scroll = wx.ScrolledWindow(self, -1, size=(1250,500))
self.scroll.SetScrollbars(1,1,1400,1600)
topSizer = wx.BoxSizer(wx.VERTICAL)
panelSizer1 = wx.BoxSizer(wx.HORIZONTAL)
panelSizer2 = wx.BoxSizer(wx.HORIZONTAL)
panelSizer3 = wx.BoxSizer(wx.HORIZONTAL)
panelSizer4 = wx.BoxSizer(wx.HORIZONTAL)
self.p1 = Panel(self.scroll, "SITE1")
self.p2 = Panel(self.scroll, "SITE2")
self.p3 = Panel(self.scroll, "SITE3")
self.p4 = Panel(self.scroll, "SITE4")
self.p5 = Panel(self.scroll, "SITE5")
self.p6 = Panel(self.scroll, "SITE6")
self.p7 = Panel(self.scroll, "SITE7")
self.p8 = Panel(self.scroll, "SITE8")
self.panels = [self.p1, self.p2, self.p3, self.p4, self.p5, self.p6, self.p7, self.p8]
panelSizer1.Add(self.p1, 0, wx.ALL|wx.EXPAND,5)
panelSizer1.Add(self.p2, 0, wx.ALL|wx.EXPAND,5)
panelSizer2.Add(self.p3, 0, wx.ALL|wx.EXPAND,5)
panelSizer2.Add(self.p4, 0, wx.ALL|wx.EXPAND,5)
panelSizer3.Add(self.p5, 0, wx.ALL|wx.EXPAND,5)
panelSizer3.Add(self.p6, 0, wx.ALL|wx.EXPAND,5)
panelSizer4.Add(self.p7, 0, wx.ALL|wx.EXPAND,5)
panelSizer4.Add(self.p8, 0, wx.ALL|wx.EXPAND,5)
topSizer.Add(panelSizer1, 0, wx.ALL|wx.EXPAND, 5)
topSizer.Add(panelSizer2, 0, wx.ALL|wx.EXPAND, 5)
topSizer.Add(panelSizer3, 0, wx.ALL|wx.EXPAND, 5)
topSizer.Add(panelSizer4, 0, wx.ALL|wx.EXPAND, 5)
self.scroll.SetSizer(topSizer)
topSizer.Fit(self.scroll)
menu = wx.Menu()
windowtimemenu = menu.Append(101, "Set Window Time", "Minute")
self.Bind(wx.EVT_MENU, self.OnSetWtime, windowtimemenu)
menu.Append(wx.ID_ABOUT, "About", "About")
exitmenu = menu.Append(wx.ID_EXIT, "EXIT", "Close")
self.Bind(wx.EVT_MENU, self.OnExit, exitmenu)
menubar = wx.MenuBar()
menubar.Append(menu, "Menu")
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
self.e = threading.Event()
self.SetMenuBar(menubar)
self.Show()
我的问题......