简体   繁体   中英

Create a strikethrough in wxpython listctrl

I am using a wx.listctrl inside a wxpython GUI. I have a list that updates when I click a button. Currently when I select an item and click the button, I do the following:

item = self.my_list.GetItem(row_in_list)
self.my_list.SetItemTextColour(row_in_list,'red')

In addition to turning the font red, I would like to "cross it out" or "strikethrough". I have found wx.FFont(8, wx.FONTFAMILY_SWISS, face='Tahoma', flags = wx.FONTFLAG_STRIKETHROUGH) but this does not seem to work. Any one have ideas? Thanks!

As far as I can tell, strike-throughs are not supported in the ListCtrl widget itself. You would have to create some kind of custom widget or switch to using the aforementioned UltimateListCtrl, which is a very flexible pure Python widget. You can see it in action in the wxPython demo package or read about in the following links:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM