python - 如何制作自动滚动的wx.grid表格?

标签 python wxwidgets

python 2.7 我有 wx.grid 表。如何进行垂直滚动?

我尝试过:

MakeCellVisible(rows,cols) 

SetGridCursor(rows, cols)

但是他们没有工作。

最佳答案

用途:

grid_widget.Scroll(row, column)
<小时/>

编辑:这里有一个工作示例:

enter image description here

它是用以下内容制作的:

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()

关于python - 如何制作自动滚动的wx.grid表格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8665633/

相关文章:

python - 如何在Python中使用RTSP

python - Numpy 索引赋值的 Tensorflow 等价物

c++ - 使用 wxWidgets 多线程时的奇怪行为

c++ - 在 C++ 中将值插入多维 vector

c++ - 启用深度测试时,OpenGL 不会丢弃我的片段

python - 在 Tornado python中设置openId

python - gspread 给出 TypeError : expected bytes when trying to log in

macos - Alien::wxWidgets 在 OSX10.10 上安装失败

macos - "Enter Full Screen"wxWidgets 中的热键

python - "invalid default value"带有 lxml 和 ATTLIST 标签