gri*_*yvp 2 python wxwidgets wxpython
我的 Windows 8 上安装了带有 wxWidgets 2.8.11.0 的 python 2.7。如果我执行以下代码:
import wx
app = wx.App( redirect = False )
wnd = wx.Frame( parent = None )
widget = wx.ListCtrl( parent = wnd, style = wx.LC_REPORT )
widget.InsertColumn( 0, "items" )
widget.InsertStringItem( 0, "foo" )
widget.InsertStringItem( 1, "bar" )
widget.InsertStringItem( 2, "baz" )
widget.Select( 1 )
wnd.Show()
app.MainLoop()
Run Code Online (Sandbox Code Playgroud)
我看到了一个包含 3 个项目列表的窗口,第二个被选中。但是如果我按“向下”键 -选择了第一项!是否可以选择项目,因此按“向上”和“向下”键将移动现有选择并且不会跳到第一个项目?
同时使用Select(突出显示)和Focus(使该行成为当前行):
........
widget.Focus(1)
widget.Select(1)
..........
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2693 次 |
| 最近记录: |