Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ListCtrl Demo to work on wxPy4.0 and 4.1 #1509

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions demo/ListCtrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ def __init__(self, parent, log):

self.list.SetImageList(self.il, wx.IMAGE_LIST_SMALL)
sizer.Add(self.list, 1, wx.EXPAND)
self.list.EnableCheckBoxes(enable=True)
if wx.VERSION >= (4, 1):
self.list.EnableCheckBoxes(enable=True)

self.PopulateList()

Expand Down Expand Up @@ -326,19 +327,21 @@ def OnRightClick(self, event):
self.popupID4 = wx.NewIdRef()
self.popupID5 = wx.NewIdRef()
self.popupID6 = wx.NewIdRef()
self.popupID7 = wx.NewIdRef()
self.popupID8 = wx.NewIdRef()
self.popupID9 = wx.NewIdRef()
if wx.VERSION >= (4, 1):
self.popupID7 = wx.NewIdRef()
self.popupID8 = wx.NewIdRef()
self.popupID9 = wx.NewIdRef()

self.Bind(wx.EVT_MENU, self.OnPopupOne, id=self.popupID1)
self.Bind(wx.EVT_MENU, self.OnPopupTwo, id=self.popupID2)
self.Bind(wx.EVT_MENU, self.OnPopupThree, id=self.popupID3)
self.Bind(wx.EVT_MENU, self.OnPopupFour, id=self.popupID4)
self.Bind(wx.EVT_MENU, self.OnPopupFive, id=self.popupID5)
self.Bind(wx.EVT_MENU, self.OnPopupSix, id=self.popupID6)
self.Bind(wx.EVT_MENU, self.OnCheckAllBoxes, id=self.popupID7)
self.Bind(wx.EVT_MENU, self.OnUnCheckAllBoxes, id=self.popupID8)
self.Bind(wx.EVT_MENU, self.OnGetItemsChecked, id=self.popupID9)
if wx.VERSION >= (4, 1):
self.Bind(wx.EVT_MENU, self.OnCheckAllBoxes, id=self.popupID7)
self.Bind(wx.EVT_MENU, self.OnUnCheckAllBoxes, id=self.popupID8)
self.Bind(wx.EVT_MENU, self.OnGetItemsChecked, id=self.popupID9)

# make a menu
menu = wx.Menu()
Expand All @@ -349,9 +352,10 @@ def OnRightClick(self, event):
menu.Append(self.popupID4, "DeleteAllItems")
menu.Append(self.popupID5, "GetItem")
menu.Append(self.popupID6, "Edit")
menu.Append(self.popupID7, "Check All Boxes")
menu.Append(self.popupID8, "UnCheck All Boxes")
menu.Append(self.popupID9, "Get Checked Items")
if wx.VERSION >= (4, 1):
menu.Append(self.popupID7, "Check All Boxes")
menu.Append(self.popupID8, "UnCheck All Boxes")
menu.Append(self.popupID9, "Get Checked Items")

# Popup the menu. If an item is selected then its handler
# will be called before PopupMenu returns.
Expand Down