如何使自动滚动wx.grid表?
问题描述:
python 2.7我有wx.grid
表。我如何做垂直滚动?如何使自动滚动wx.grid表?
我想:
MakeCellVisible(rows,cols)
和
SetGridCursor(rows, cols)
,但他们没有工作。
答
用途:
grid_widget.Scroll(row, column)
编辑:这里有一个工作示例:
这与制作:
import wx
import wx.grid as grid
#
class Button(wx.Frame):
def __init__(self, parent, source):
wx.Frame.__init__(self, parent, -1, size=(100,100))
self.source = source
self.pos = 0
self.button = wx.Button(self, label='0')
self.Bind(wx.EVT_BUTTON, self.onbutton, self.button)
self.Show()
def onbutton(self, evt):
self.pos += 1
self.source.grid.Scroll(self.pos, self.pos)
self.button.SetLabel(str(self.pos))
class Frame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1, "Grid", size=(350,250))
self.grid = grid.Grid(self)
self.grid.CreateGrid(20, 20)
self.but = Button(None, self)
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = Frame(None)
frame.Show()
app.MainLoop()
答
我有同样的PROBL EM。只是尝试使用网格功能MakeCellVisible(行,列)
它没有工作。没有效果 – user1000571 2011-12-29 14:27:59
@ user1000571请参阅编辑 – joaquin 2011-12-29 17:08:06