Added experiment of a selectableList (not implemented, et)

This commit is contained in:
Manuel Cortez 2019-04-26 17:49:54 -05:00
parent b914e4b548
commit 20c3df6be2

View File

@ -4,6 +4,7 @@ from __future__ import unicode_literals
import languageHandler
import paths
import wx
import wx.lib.mixins.listctrl as listmix
from builtins import range
toolkit = "wx"
@ -134,6 +135,22 @@ class mainLoopObject(wx.App):
def run(self):
self.app.MainLoop()
class selectableList(wx.ListCtrl, listmix.CheckListCtrlMixin):
def __init__(self, *args, **kwargs):
wx.ListCtrl.__init__(self, *args, **kwargs)
listmix.CheckListCtrlMixin.__init__(self)
listmix.ListCtrlAutoWidthMixin.__init__(self)
self.Bind(wx.EVT_CHAR_HOOK, self.on_keydown)
def OnCheckItem(self, index, flag):
print(index, flag)
def on_keydown(self, event):
if event.GetKeyCode() == wx.WXK_SPACE:
print("spacebar")
self.ToggleItem(self.GetFocusedItem())
event.Skip()
class list(object):
def __init__(self, parent, *columns, **listArguments):
self.columns = columns