How to accommodate large fonts in a listctrl

33 views
Skip to first unread message

Bill Bell

unread,
Nov 12, 2017, 10:34:04 AM11/12/17
to wxPython-users
Many or most will recognise these lines from the listctrl demo code, with a little modification.

I can change the font for a line in a listctrl using the lines shown at the end of this fragment. However, the lines in the listctrl do not increase in height to accommodate the larger font, and I am at a loss as to how to request a larger size.

Can someone please advise me?

        items = musicdata.items()
       
for key, data in items:
            index
= self.list.InsertItem(self.list.GetItemCount(), data[0])
           
self.list.SetItem(index, 1, data[1])
           
self.list.SetItem(index, 2, data[2])
           
self.list.SetItemData(index, key)


            font
= wx.Font(self.GetClassDefaultAttributes().font)
            font
.SetPixelSize((0,25))
           
self.list.SetItemFont(index, font)



Andrea Gavana

unread,
Nov 12, 2017, 1:03:39 PM11/12/17
to wxPython-users
Hi,

It seems to be working slightly better if you add this line:

        self.list.SetFont(font)

At the end of the for loop. Not pretty to look at, but better than before...

Andrea.


 

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bill Bell

unread,
Nov 12, 2017, 1:20:43 PM11/12/17
to wxPython-users

Thank you! Definitely good enough for my purposes.

Bill
Hi,

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages