Upgraded from wx 3 to 4 and voila, it works (almost completely) - congratulations!!

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

Upgraded from wx 3 to 4 and voila, it works (almost completely) - congratulations!!

Arra Avakian
When Google dropped their portal, what I missed most was their bookmarks widget, so some years ago I wrote my own as a stand alone Windows app using wxPython. I have been quite happy with it. (It worked on a Mac but I was less happy.)
I recently got a new Windows laptop and needed to reinstall wxPython, and opted for wx 4, with some trepidation.
I have not looked at my python code for more than a year, or any code at all since retiring last February (!!!).
The app worked almost perfectly, and I was astounded at the level of compatibility.
My app uses the ListCtrl in LC_REPORT mode and two columns, with clickable headers to sort that column.
A second click sorts that column in reverse, with the column header showing the up or down image to indicate the sort order.
The change I have noticed with using wx 4 is that those direction images appear also in the column zero data rows, even after clicking in a different column. The attached image shows the app after I clicked twice on the "url" header,
and has the unwanted direction images showing in all of the data rows. I have also attached the python module for the GUI part of the app.

The details of adding the images was the result of experimentation using wx 3 in my forgotten past.
It probably needs some cleanup! 

Does anyone understand why those arrow images appear in the data rows in addition to the header?

--
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.

bookmarks.png (241K) Download Attachment
wbm.pyc (46K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Upgraded from wx 3 to 4 and voila, it works (almost completely) - congratulations!!

Arra Avakian
I missed clicked the pyc file, sorry. Attaching the SOURCE.

On Saturday, November 25, 2017 at 4:58:20 PM UTC-5, Arra Avakian wrote:
When Google dropped their portal, what I missed most was their bookmarks widget, so some years ago I wrote my own as a stand alone Windows app using wxPython. I have been quite happy with it. (It worked on a Mac but I was less happy.)
I recently got a new Windows laptop and needed to reinstall wxPython, and opted for wx 4, with some trepidation.
I have not looked at my python code for more than a year, or any code at all since retiring last February (!!!).
The app worked almost perfectly, and I was astounded at the level of compatibility.
My app uses the ListCtrl in LC_REPORT mode and two columns, with clickable headers to sort that column.
A second click sorts that column in reverse, with the column header showing the up or down image to indicate the sort order.
The change I have noticed with using wx 4 is that those direction images appear also in the column zero data rows, even after clicking in a different column. The attached image shows the app after I clicked twice on the "url" header,
and has the unwanted direction images showing in all of the data rows. I have also attached the python module for the GUI part of the app.

The details of adding the images was the result of experimentation using wx 3 in my forgotten past.
It probably needs some cleanup! 

Does anyone understand why those arrow images appear in the data rows in addition to the header?

--
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.

wbm.py (30K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Upgraded from wx 3 to 4 and voila, it works (almost completely) - congratulations!!

Robin Dunn
In reply to this post by Arra Avakian


On Saturday, November 25, 2017 at 1:58:20 PM UTC-8, Arra Avakian wrote:
When Google dropped their portal, what I missed most was their bookmarks widget, so some years ago I wrote my own as a stand alone Windows app using wxPython. I have been quite happy with it. (It worked on a Mac but I was less happy.)
I recently got a new Windows laptop and needed to reinstall wxPython, and opted for wx 4, with some trepidation.
I have not looked at my python code for more than a year, or any code at all since retiring last February (!!!).
The app worked almost perfectly, and I was astounded at the level of compatibility.
My app uses the ListCtrl in LC_REPORT mode and two columns, with clickable headers to sort that column.
A second click sorts that column in reverse, with the column header showing the up or down image to indicate the sort order.
The change I have noticed with using wx 4 is that those direction images appear also in the column zero data rows, even after clicking in a different column. The attached image shows the app after I clicked twice on the "url" header,
and has the unwanted direction images showing in all of the data rows. I have also attached the python module for the GUI part of the app.

The details of adding the images was the result of experimentation using wx 3 in my forgotten past.
It probably needs some cleanup! 

Does anyone understand why those arrow images appear in the data rows in addition to the header?


The native Windows widget used to implement wx.ListCtrl assumes that if you have an ImageList then each item will have an icon. It seems to have no concept of only having icons on the column headers and not on the items. It will always reserve space for the icon, but you should be able to tell it to not use one when you are inserting new items. Try changing:

    self.bmlist.InsertStringItem(i, bm.title)

to

self.bmlist.InsertItem(i, bm.title, -1)

The other option would be to add an icon for the items, perhaps a transparent one if you don't want anything to be visible.
 
-- 
Robin Dunn
Software Craftsman
http://wxPython.org

--
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: Upgraded from wx 3 to 4 and voila, it works (almost completely) - congratulations!!

Arra Avakian

Robin,
This worked great, thanks!
Arra

On 11/28/2017 12:03 PM, Robin Dunn wrote:
Try changing:

    self.bmlist.InsertStringItem(i, bm.title)
to
self.bmlist.InsertItem(i, bm.title, -1)

--
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.