如何制作自动滚动的 wx.grid 表格? [英] How to make auto scrolling wx.grid table?

查看:35
本文介绍了如何制作自动滚动的 wx.grid 表格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

python 2.7 I have wx.grid table. How can I do vertical scrolling?

我试过了:

MakeCellVisible(rows,cols) 

SetGridCursor(rows, cols)

但它们没有用.

推荐答案

使用:

grid_widget.Scroll(row, column)

<小时>

这里有一个工作示例:


Here you have a working example:

这是由:

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

这篇关于如何制作自动滚动的 wx.grid 表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆