wx.网格不更新行数

2024-03-28 08:46:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我想更新一个wx.grid.PyGridTableBase通过打电话网格.ForceRefresh()在更改表数据之后。但是,行数不会被刷新,因此表仍然显示原始(更新之前)的行数。我能做些什么来完全更新网格吗?在


Tags: 数据网格gridwxpygridtablebaseforcerefresh
1条回答
网友
1楼 · 发布于 2024-03-28 08:46:09

您可能忘记通知网格您所做的更改。您可以在wxPython演示中找到一个示例,也可以阅读以下主题的旧主题:

https://groups.google.com/forum/?fromgroups=#!msg/wxpython-users/z4iobAKq0os/zzUL70WzL_AJ

上面写着:

msg = wx.grid.GridTableMessage(self,          # The table
      wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED, # what we did to it
      1                                       # how many
      )

或者

^{pr2}$

或者

msg = wx.grid.GridTableMessage(self,          # The table
      wx.grid.GRIDTABLE_NOTIFY_ROWS_DELETED,  # what we did to it
      5,                                      # from which row
      1                                       # how many
      )

其次是

self.GetView().ProcessTableMessage(msg)

您也可以在wxpythonwiki上阅读到这一点:http://wiki.wxpython.org/wxGrid

相关问题 更多 >