How to accommodate large fonts in a listctrl

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to accommodate large fonts in a listctrl

Bill Bell
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)



--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to accommodate large fonts in a listctrl

Andrea Gavana
Hi,

On 12 November 2017 at 16:34, Bill Bell <[hidden email]> wrote:
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)





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 [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to accommodate large fonts in a listctrl

Bill Bell

Thank you! Definitely good enough for my purposes.

Bill


On Sunday, 12 November 2017 13:03:39 UTC-5, Infinity77 wrote:
Hi,

On 12 November 2017 at 16:34, Bill Bell <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="7-yz9j35AAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">bell...@...> wrote:
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)





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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="7-yz9j35AAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">wxpython-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.