Discuss wxPython - Latest posts https://discuss.wxpython.org Latest posts SplitterWindow sash not visible on Windows Ah yes, “broken as designed”. Invented at IBM in the '70s but embraced by all software manufacturers over time -:frowning:

]]>
https://discuss.wxpython.org/t/splitterwindow-sash-not-visible-on-windows/40426#post_4 Sun, 15 Mar 2026 17:59:12 +0000 discuss.wxpython.org-post-126521
SplitterWindow sash not visible on Windows Unfortunately that’s now the standard on Windows. If you don’t know that there is a splitter, you’re lost…

]]>
https://discuss.wxpython.org/t/splitterwindow-sash-not-visible-on-windows/40426#post_3 Sun, 15 Mar 2026 17:20:07 +0000 discuss.wxpython.org-post-126519
SplitterWindow sash not visible on Windows Screenshot showing the sash is there and functional, just not visible.

]]>
https://discuss.wxpython.org/t/splitterwindow-sash-not-visible-on-windows/40426#post_2 Sun, 15 Mar 2026 16:59:18 +0000 discuss.wxpython.org-post-126518
SplitterWindow sash not visible on Windows No matter what style(s) I enable, the sash is never visible. I’m using wxFormBuilder to create the UI. Everything works as expected, the only problem is the sash isn’t visible.

I can only embed one image, so I’ll add a screenshot in a reply.

Here’s the structure in wxFormBuilder:

And all mentions of the Splitter in the generated Frame code:

        self.m_splitter1 = wx.SplitterWindow( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SP_3D|wx.SP_THIN_SASH )
        self.m_splitter1.SetSashGravity( 0.5 )
        self.m_splitter1.Bind( wx.EVT_IDLE, self.m_splitter1OnIdle )
        self.m_splitter1.SetMinimumPaneSize( 50 )
...
        self.m_panel1 = wx.Panel( self.m_splitter1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
...
        self.m_panel2 = wx.Panel( self.m_splitter1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
...
        self.m_splitter1.SplitHorizontally( self.m_panel1, self.m_panel2, 0 )
        bSizer7.Add( self.m_splitter1, 1, wx.EXPAND, 5 )
...
    def m_splitter1OnIdle( self, event ):
        self.m_splitter1.SetSashPosition( 0 )
        self.m_splitter1.Unbind( wx.EVT_IDLE )

Any suggestions on how to get the sash to be visible?

]]>
https://discuss.wxpython.org/t/splitterwindow-sash-not-visible-on-windows/40426#post_1 Sun, 15 Mar 2026 16:58:46 +0000 discuss.wxpython.org-post-126517
Frame.Raise() not working on Windows Adding Show() did nothing. However the Iconize(True)/Iconize(False) trick works well. It happens so quickly that it’s not objectionable.

Unless there’s a magic incantation for getting Raise() to work, I’ll just go with that.

Thanks

]]>
https://discuss.wxpython.org/t/frame-raise-not-working-on-windows/40425#post_6 Sun, 15 Mar 2026 16:39:00 +0000 discuss.wxpython.org-post-126516
Frame.Raise() not working on Windows I’ll try those options.

But now it gets more interesting. Raise() fails to work when the app is packaged by

pyinstaller -F -w appname.py

BUT, when run from within pyCharm (after enabling “allow multiple instances”) it DOES work as expected.

]]>
https://discuss.wxpython.org/t/frame-raise-not-working-on-windows/40425#post_5 Sun, 15 Mar 2026 16:24:39 +0000 discuss.wxpython.org-post-126515
Frame.Raise() not working on Windows I have some code where I call Show before Raise. I don’t remember why I have this. Maybe you want to try it.

And: would Iconize(True); Iconize(False) work?

]]>
https://discuss.wxpython.org/t/frame-raise-not-working-on-windows/40425#post_4 Sat, 14 Mar 2026 23:43:06 +0000 discuss.wxpython.org-post-126514
Frame.Raise() not working on Windows Ah, I missed that. Thanks.

]]>
https://discuss.wxpython.org/t/frame-raise-not-working-on-windows/40425#post_3 Sat, 14 Mar 2026 22:36:32 +0000 discuss.wxpython.org-post-126513
Frame.Raise() not working on Windows wx.Frame inherits the Raise() method from wx.Window().

There is a caveat in the documentation which says:

Notice that this function only requests the window manager to raise this window to the top of Z-order. Depending on its configuration, the window manager may raise the window, not do it at all or indicate that a window requested to be raised in some other way, e.g. by flashing its icon if it is minimized.

]]>
https://discuss.wxpython.org/t/frame-raise-not-working-on-windows/40425#post_2 Sat, 14 Mar 2026 19:58:08 +0000 discuss.wxpython.org-post-126512
Frame.Raise() not working on Windows Here’s the code, which runs in a daemon thread to respond to notifications from second instances (to prevent multiple instances). All the IPC code is working fine, the only problem is that frm.Raise() doesn’t raise the window.

        if frm.IsIconized(): frm.Iconize(False)
        frm.Raise()
        frm.mToday.SetFocus()

If the window is iconized, then frm.Iconize(False) both restores the window and raises it. However, if the window is not iconized, but partially or completely hidden under another window, the taskbar icon flashes but the window is not raised.

I also tried using CallAfter(frm.Raise) but it had no effect.

What am I missing? Is the fact that this runs in a daemon thread the problem? Is this just a limitation of Windows 11?

]]>
https://discuss.wxpython.org/t/frame-raise-not-working-on-windows/40425#post_1 Sat, 14 Mar 2026 19:36:42 +0000 discuss.wxpython.org-post-126511
DataViewListCtrl last column fixed size/non-resizable still takes all remaining space While not precisely what you were asking for, I also found this behavior (annoying). I solved it with a custom size event. Here’s the gist:

import wx
import wx.dataview as dv

class FileListPanel(wx.Panel):
    """Docstring for FileListPanel"""
    def __init__(self, parent, *args, **kwds):
        error_file = kwds.pop('file')
        super().__init__(parent, *args, **kwds)  # Call the parent class's constructor

        list_sizer = wx.BoxSizer(wx.VERTICAL)

        self.file_list = dv.DataViewListCtrl(self)
        list_sizer.Add(self.file_list, 1, wx.EXPAND, 0)

        file_col = self.file_list.AppendTextColumn('File')
        file_col.SetResizeable(True)
        file_col.SetMinWidth(200)
        count_col = self.file_list.AppendTextColumn('Embedded')
        count_col.SetWidth(80)
        count_col.SetResizeable(False)

        self.SetSizer(list_sizer)
        self.Layout()
        self.file_list.Bind(wx.EVT_SIZE, self.on_size)

    def on_size(self, evt) -> None:
        evt.Skip()
        self.size_columns()

    def size_columns(self) -> None:
        desired_count_width = 100
        size = self.file_list.GetSize()
        file_col, count_col = self.file_list.GetColumns()
        file_col.SetWidth(size.width - desired_count_width)
        count_col.SetWidth(desired_count_width)

Joe

]]>
https://discuss.wxpython.org/t/dataviewlistctrl-last-column-fixed-size-non-resizable-still-takes-all-remaining-space/40422#post_3 Fri, 13 Mar 2026 22:02:16 +0000 discuss.wxpython.org-post-126510
Detected Dark / Light / System mode It’s likely I’ll need to roll my own, something like Ap.Application.GetAppearance()
I’m waiting on a new snapshot to test, wxpython-4.3.0a16032 binaries are missing
virtual void __cdecl wxAppBase::DoDelayedCleanup(void)

]]>
https://discuss.wxpython.org/t/detected-dark-light-system-mode/40410#post_14 Thu, 12 Mar 2026 22:42:07 +0000 discuss.wxpython.org-post-126509
Detected Dark / Light / System mode I see, so it seems there could be a conflict if I use wxTheApp->MSWEnableDarkMode, and the Python client uses wxSystemSettings::GetAppearance(), there should be a wxApp::GetAppearance()

]]>
https://discuss.wxpython.org/t/detected-dark-light-system-mode/40410#post_13 Thu, 12 Mar 2026 22:35:23 +0000 discuss.wxpython.org-post-126508
Detected Dark / Light / System mode ‘darkdetect’ is meant to report the system setting, and is not reliant (or intended specifically) a particular GUI toolkit.

For Linux, darkdetect seems to assume that “gitk-theme” is the reliable source of this information. I believe he original posting here, and as I have seen myself in some situations on Linux, “gtk-theme” can be different from wx.SystemSetting.GetAppearance().IsDark(). I don’t know enough about the details to know what is different.

]]>
https://discuss.wxpython.org/t/detected-dark-light-system-mode/40410#post_12 Thu, 12 Mar 2026 21:06:38 +0000 discuss.wxpython.org-post-126507
wxPython master branch now tracking wxWidgets 3.3 is it possible to make a snapshot build against wx 3.3.2?

]]>
https://discuss.wxpython.org/t/wxpython-master-branch-now-tracking-wxwidgets-3-3/40403#post_7 Wed, 11 Mar 2026 06:57:51 +0000 discuss.wxpython.org-post-126505
Detected Dark / Light / System mode

By “embedded”, do you mean an application that owns the whole windowing system?

Right, my project embeds wxWidgets/wxPython inside AutoCAD. AutoCAD has its own dark/light mode independent of the OS. The plan is to call wxTheApp->MSWEnableDarkMode based on AutoCAD’s color theme. I’ve been testing a bit here GitHub - CEXT-Dan/WxArx: Example using wxWidgets with AutoCAD's ObjectARX · GitHub. I assume python users will be able to control this, as wxTheApp and wx.App.Get() are pointing to the same instance.
isDark is ambiguous, is wxWidgets currently set in dark mode, is the OS in dark mode? So it’s clear, I’m not against this, just asking

]]>
https://discuss.wxpython.org/t/detected-dark-light-system-mode/40410#post_11 Tue, 10 Mar 2026 06:11:02 +0000 discuss.wxpython.org-post-126504
Detected Dark / Light / System mode

How would this effect embedded projects where dark/light mode is set in the host application through wxWidgets?

I don’t know. It’s possible that I don’t understand the question. By “embedded”, do you mean an
application that owns the whole windowing system? If so, then I definitely have no idea.
Can wxPython set change dark/light mode?

]]>
https://discuss.wxpython.org/t/detected-dark-light-system-mode/40410#post_10 Tue, 10 Mar 2026 00:23:01 +0000 discuss.wxpython.org-post-126503
Detected Dark / Light / System mode How would this effect embedded projects where dark/light mode is set in the host application through wxWidgets?

]]>
https://discuss.wxpython.org/t/detected-dark-light-system-mode/40410#post_9 Mon, 09 Mar 2026 23:49:29 +0000 discuss.wxpython.org-post-126502
wxDatePickerCtrl firing change events on calendar navigation I have a wxDatePickerCtrl configured with wxDP_DROPDOWN to display the calendar. I was expecting to get a DateChanged event when the user selected a date, but I’m getting events when the user merely navigates forwards or backwards in the calendar.

I can see that what’s happening is that wxWidgets is “selecting” a date after changing the calendar, and I guess it’s working as designed.

My question: Is there a way to distinguish a real “user chose a date” event from “a date was selected due to navigating within the calendar”? The DateEvent object doesn’t seem to have anything that would help. Or, maybe, a way to turn off those “spurious” events?

]]>
https://discuss.wxpython.org/t/wxdatepickerctrl-firing-change-events-on-calendar-navigation/40423#post_1 Mon, 09 Mar 2026 21:52:04 +0000 discuss.wxpython.org-post-126501
DataViewListCtrl last column fixed size/non-resizable still takes all remaining space I get the same result using wxPython 4.2.5 gtk3 (phoenix) wxWidgets 3.2.9 + Python 3.12.3 + Linux Mint 22.3.

I couldn’t see a way to get the behaviour you want using the DataViewListCtrl.

The UltimateListCtrl has a ULC_AUTOSIZE_FILL setting, but I could only get it to work on a single column.

Here is a simple example:

import wx
import wx.lib.agw.ultimatelistctrl as ULC

DATA = (
    ("aaaaa bbbbb ccccc ddddd eeeee fffff", "Red"),
    ("aaaaa bbbbb ccccc ddddd eeeee fffff ggggg", "Green"),
    ("aaaaa bbbbb ccccc ddddd eeeee fffff ggggg hhhhh", "Blue"),
)


class MyFrame(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent, -1, "ULC_AUTOSIZE_FILL Demo")
        self.SetSize(560, 300)
        agw_style = ULC.ULC_REPORT | ULC.ULC_VRULES | ULC.ULC_HRULES | ULC.ULC_SINGLE_SEL
        self.ulc = ULC.UltimateListCtrl(self, wx.ID_ANY, agwStyle=agw_style)

        self.ulc.InsertColumn(0, "Col 0")
        # This has no effect, only "Col 1" automatically resizes
        self.ulc.SetColumnWidth(0, ULC.ULC_AUTOSIZE_FILL)

        self.ulc.InsertColumn(1, "Col 1")
        # This works - the column fills the remaining 
        # space and resizes when the frame is resized
        self.ulc.SetColumnWidth(1, ULC.ULC_AUTOSIZE_FILL)
        
        self.ulc.InsertColumn(2, "Col 2")

        for i, (a, b) in enumerate(DATA):
            index = self.ulc.InsertStringItem(i, "Row %d" % i)
            self.ulc.SetStringItem(index, 1, a)
            self.ulc.SetStringItem(index, 2, b)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.ulc, 1, wx.EXPAND)

        self.SetSizer(sizer)
        self.Layout()


if __name__ == "__main__":
    app = wx.App(0)
    frame = MyFrame(None)
    frame.Show()
    app.MainLoop()

vokoscreenNG-2026-03-09_14-15-36

]]>
https://discuss.wxpython.org/t/dataviewlistctrl-last-column-fixed-size-non-resizable-still-takes-all-remaining-space/40422#post_2 Mon, 09 Mar 2026 14:25:59 +0000 discuss.wxpython.org-post-126500
DataViewListCtrl last column fixed size/non-resizable still takes all remaining space wxPython on Windows

I want the last column of a DataViewLIstCtrl to have a fixed size, with remaining space spread out over all the other columns. Google results suggest this is accomplished by

  • Setting the last column width to a fixed amount (i.e. 100px) and removing the wxDATAVIEW_COL_RESIZABLE flag
  • Making all the other columns resizable

I did this but the last column still takes up all remaining space. Is this just a limitation of the Windows implementation?

]]>
https://discuss.wxpython.org/t/dataviewlistctrl-last-column-fixed-size-non-resizable-still-takes-all-remaining-space/40422#post_1 Sun, 08 Mar 2026 22:48:55 +0000 discuss.wxpython.org-post-126499
Re-labelling wx.wizard buttons Hello, I made the test again with version 4.2.5 of wxPython, the behavior is still the same. Event if the Next button label seems to be modified by setlabel function the label displayed is always Next (or Finish for the last panel). For Previous and Cancel buttons all is working fine. Any idea on what is going wrong? Thanks

]]>
https://discuss.wxpython.org/t/re-labelling-wx-wizard-buttons/25604#post_5 Sun, 08 Mar 2026 16:18:27 +0000 discuss.wxpython.org-post-126498
Detected Dark / Light / System mode

Preferably, I don’t want to use any external packages

Do you mean “I don’t want to use any external packages except for the very large and complex external package called wxPython which is the focus of this discussion forum”?

darkdetect is pure python with minimal external dependencies (None on Window/Linux, 1 optional one on Mac), and is independent of the GUI toolkit.

My suggestion here is that wxPython add it as a dependency and use it, or (worse) simply borrow the code (BSD licensed).

As for the best practice for enabling dark mode on Windows, I’ll simply wait until everything is finalized and, if possible, for a concrete example of its use with wxPython.

Over at wxutils (GitHub - newville/wxutils: wxPython utilities and convenience functions · GitHub) (yes, an external package, so you may not be interested), I recently added darkdetect as a dependency and use it to set many colors by “logical name” (‘text’, ‘text_bg’, etc) that will have different values in Light and Dark mode. It also uses darkdetect 'listener" to run a daemon thread to run registered callbacks when the System mode changes. That means the widgets not only get usable colors when an App starts, but they change when the System mode changes. These changes are fairly new, and there may be a some issues, but the results are readable and don’t give dark text on a dark background or light text on a light background. That may be of interest to some readers here.

This is now used in the latest version of wxmplot (again, an external package and with its own external dependencies including matplotlib which you would probably not want to use, but that others might find useful), and in several downstream applications that I support. Some of these have somewhat complex GUI components and context-sensitive text colors, say using validators to color-code invalid values or warning levels. These are working well at both respecting the System mode at startup and adapting when that mode changes.

Those might count as concrete examples.

]]>
https://discuss.wxpython.org/t/detected-dark-light-system-mode/40410#post_8 Sun, 08 Mar 2026 15:45:19 +0000 discuss.wxpython.org-post-126497
Sorting a ListCtrl column There are also quite a few limitations & operating system specific bugs with ListCtrl (like the first column icons on windows)…

There is also the UltimateListCtrl widget which is often suggested here as many of the enhanced features from the mixins are already available.
However, I’ve never used this myself but could be worth also looking through the examples to see if it fits your needs,

GabboCH

]]>
https://discuss.wxpython.org/t/sorting-a-listctrl-column/40420#post_10 Sun, 08 Mar 2026 09:40:00 +0000 discuss.wxpython.org-post-126496
Detected Dark / Light / System mode Preferably, I don’t want to use any external packages. As for the best practice for enabling dark mode on Windows, I’ll simply wait until everything is finalized and, if possible, for a concrete example of its use with wxPython. Sorry if I’m being impatient :slight_smile:

]]>
https://discuss.wxpython.org/t/detected-dark-light-system-mode/40410#post_7 Sun, 08 Mar 2026 09:20:38 +0000 discuss.wxpython.org-post-126495
Sorting a ListCtrl column Hello,
You can find a lot of examples on the wxpython wiki or on Mike Driscoll’s blog.
Here are a few:






Regards

]]>
https://discuss.wxpython.org/t/sorting-a-listctrl-column/40420#post_9 Sun, 08 Mar 2026 08:59:22 +0000 discuss.wxpython.org-post-126494
Sorting a ListCtrl column Bingo, Richard! That works for me. Thanks.
Having said which, a dreadful thought occurs to me: I may have been (mostly) wasting everybody’s time:
I want a virtual ListCtrl. I now guess it is NOT POSSIBLE to sort a VIRTUAL ListCtrl (this seems obvious when I think about how it might (not) work).
So what I should do is sort my data, then use RefreshItems(), along with EnsureVisible() and Focus(), as appropriate (a quick test indicated that this will work).
Duh! Why didn’t I think of it before? I suppose because I unthinkingly assumed ListCtrl would do it for me.
Maybe the moral is “When asking a question, show your code”.
I didn’t do that because it wasn’t particularly short and I didn’t want to force anyone to plough through it, to work out how it should be changed.
At least this discussion forced me to think harder about what I was trying to achieve. Sometimes just talking through your problem with others helps you see the light.
Anyway, apologies and thanks again.
Rob

]]>
https://discuss.wxpython.org/t/sorting-a-listctrl-column/40420#post_8 Fri, 06 Mar 2026 17:22:00 +0000 discuss.wxpython.org-post-126493
Sorting a ListCtrl column Perhaps windows doesn’t like being passed sys.maxsize?

A possible alternative for that for-loop:

        for key, (icao, airfield) in self.itemDataMap.items():
            self.list_ctrl.Append((icao, airfield))
            # This is needed by ColumnSorterMixin
            self.list_ctrl.SetItemData(key, key)
]]>
https://discuss.wxpython.org/t/sorting-a-listctrl-column/40420#post_7 Fri, 06 Mar 2026 15:35:34 +0000 discuss.wxpython.org-post-126492
Sorting a ListCtrl column Thanks for doing this (and testing it), Richard. That ought to be just what I need.
Unfortunately, when I run it on my platform (as per my original post) I get:

Traceback (most recent call last):
File “R:\SimpleExample.py”, line 75, in
frame = MyFrame(None, wx.ID_ANY)
File “R:\SimpleExample.py”, line 42, in init
index = self.list_ctrl.InsertItem(sys.maxsize, icao)
wx._core.wxAssertionError: C++ assertion “info.m_itemId != -1” failed at …..\src\msw\listctrl.cpp(2001) in wxListCtrl::InsertItem(): Item ID must be set.

Rob

]]>
https://discuss.wxpython.org/t/sorting-a-listctrl-column/40420#post_6 Fri, 06 Mar 2026 15:19:15 +0000 discuss.wxpython.org-post-126491
Sorting a ListCtrl column Here is a simple example:

import sys
import wx
from wx.lib.mixins.listctrl import ColumnSorterMixin

AIRFIELDS = (
    ("EGBB", "Birmingham"),
    ("EGCC", "Manchester"),
    ("EGKB", "Biggin Hill"),
    ("EGKK", "Gatwick"),
    ("EGLC", "London City"),
    ("EGLF", "Farnborough"),
    ("EGLL", "Heathrow"),
    ("EGSS", "Stansted"),
)

COLUMN_SETTINGS = (
    ("ICAO", 100),
    ("Airfield", 160)
)

NUM_COLUMNS = len(COLUMN_SETTINGS)


class MyFrame(wx.Frame, ColumnSorterMixin):
    def __init__(self, parent, id=wx.ID_ANY):
        super().__init__(parent, id, "Click headings to sort")
        self.SetSize((400, 300))

        main_sizer = wx.BoxSizer(wx.VERTICAL)
        style = wx.LC_HRULES | wx.LC_REPORT | wx.LC_VRULES
        self.list_ctrl = wx.ListCtrl(self, wx.ID_ANY, style=style)

        ColumnSorterMixin.__init__(self, NUM_COLUMNS)

        for i, (heading, width) in enumerate(COLUMN_SETTINGS):
            self.list_ctrl.InsertColumn(i, heading, format=wx.LIST_FORMAT_CENTRE)
            self.list_ctrl.SetColumnWidth(i, width)

        self.itemDataMap = self.getDataDict()

        for key, (icao, airfield) in self.itemDataMap.items():
            index = self.list_ctrl.InsertItem(sys.maxsize, icao)
            self.list_ctrl.SetItem(index, 1, airfield)
            # This is needed by ColumnSorterMixin
            self.list_ctrl.SetItemData(index, key)

        main_sizer.Add(self.list_ctrl, 1, wx.EXPAND, 0)
        self.SetSizer(main_sizer)
        self.Layout()

        self.image_list = wx.ImageList(16, 16)
        self.down_arrow = self.image_list.Add(wx.Bitmap("arrow-down.png", wx.BITMAP_TYPE_PNG))
        self.up_arrow   = self.image_list.Add(wx.Bitmap("arrow-up.png", wx.BITMAP_TYPE_PNG))
        self.list_ctrl.SetImageList(self.image_list, wx.IMAGE_LIST_SMALL)


    @staticmethod
    def getDataDict():
        data_dict = {}
        for i, item in enumerate(AIRFIELDS):
            data_dict[i] = item
        return data_dict


    def GetListCtrl(self):
        return self.list_ctrl


    def GetSortImages(self):
        return self.up_arrow, self.down_arrow


if __name__ == "__main__":
    app = wx.App()
    frame = MyFrame(None, wx.ID_ANY)
    frame.Show()
    app.MainLoop()

You will need these icons:
icons.zip (1.2 KB)

Tested using: wxPython 4.2.5 gtk3 (phoenix) wxWidgets 3.2.9 + Python 3.12.3 + Linux Mint 22.3

]]>
https://discuss.wxpython.org/t/sorting-a-listctrl-column/40420#post_5 Fri, 06 Mar 2026 10:03:16 +0000 discuss.wxpython.org-post-126490
Sorting a ListCtrl column You can download the wxPython demo for v4.2.3 from Index of /wxPython4/extras/4.2.3 - the file you want is: wxPython-demo-4.2.3.tar.gz

When you unpack that file, you will get a wxPython-demo-4.2.3 folder.

Inside that folder there is a demo sub-folder.

To start the demo application, run the demo.py python script from that sub-folder.

]]>
https://discuss.wxpython.org/t/sorting-a-listctrl-column/40420#post_4 Fri, 06 Mar 2026 09:11:26 +0000 discuss.wxpython.org-post-126489
Sorting a ListCtrl column Thanks Andrea. Could you give me a link to the web page, please.
Rob

]]>
https://discuss.wxpython.org/t/sorting-a-listctrl-column/40420#post_3 Thu, 05 Mar 2026 21:29:01 +0000 discuss.wxpython.org-post-126487
Sorting a ListCtrl column I would suggest looking at the wxPython demo, and in particular at the ListCtrl sample. It shows the use of ColumnSorterMixin nicely and it’s not a particularly complicated demo.

]]>
https://discuss.wxpython.org/t/sorting-a-listctrl-column/40420#post_2 Thu, 05 Mar 2026 19:29:48 +0000 discuss.wxpython.org-post-126486
Sorting a ListCtrl column I have used wxpython for years (decades?), but have only just started using wx.ListCtrl. I have a working example.
Now I want to be able to sort by a column when the user clicks on a column header (or column), and I am finding the attempt incredibly frustrating. I don’t understand what the class documentation says about sorting (what is a “sort indicator”? - this term is never defined, nor what you are supposed to do with it). I have tried several examples on the web (most/all use a mixin) but they are all incomplete or broken.
Please, please, please, could someone give me a minimal (but complete) working program that creates a ListCtrl (2 rows and 2 columns is fine) and demonstrates how to sort by one column or another (I don’t care how the sorting is triggered, whatever is easiest).
I am using wxpython 4.2.3 and python 3.13.3 on Windows 11.
Thanks in advance,
Rob Cliffe

]]>
https://discuss.wxpython.org/t/sorting-a-listctrl-column/40420#post_1 Thu, 05 Mar 2026 19:16:59 +0000 discuss.wxpython.org-post-126485
GLCanvas: SystemError: <built-in function IsDisplaySupported> returned a result with an exception set Since you appear to be using Ubuntu 24.04, can you try installing one of the prebuilt wheels here:

https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-24.04/

]]>
https://discuss.wxpython.org/t/glcanvas-systemerror-built-in-function-isdisplaysupported-returned-a-result-with-an-exception-set/40419#post_2 Thu, 05 Mar 2026 15:14:12 +0000 discuss.wxpython.org-post-126484
GLCanvas: SystemError: <built-in function IsDisplaySupported> returned a result with an exception set Hi!

I’m having issues with wx.glcanvas.GLCanvas. I originally wanted to create a wxVTKRenderWindowInteractor which failed due to problems that boil down to wxpython’s GLCanvas.

Most notably the GLCanvas.__init__ method, but even glcanvas.GLCanvas.IsDisplaySupported([glcanvas.WX_GL_RGBA]) fail with an error along the lines of SystemError: <built-in function IsDisplaySupported> returned a result with an exception set.

Full stack trace is

NotImplementedError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/user/developer/3d-medical-imaging/wx_test.py", line 4, in <module>
    glcanvas.GLCanvas.IsDisplaySupported([glcanvas.WX_GL_RGBA])
SystemError: <built-in function IsDisplaySupported> returned a result with an exception set

My specs are

Linux 6.14.0-37-generic #37~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC x86_64 GNU/Linux
wxPython 4.2.5 from pypi
Python 3.11.14

I am not able to get any more meaningful debug messages. I tried

XDG_SESSION_TYPE=x11
WXTRACE=glcanvas
WXTRACE=all
WXDEBUG=1
G_MESSAGES_DEBUG=all
GDK_DEBUG=gl
GDK_BACKEND=x11

Maybe the problems are also called by other libraries. But I am unsure about how to approach that.

Thanks for any advice.

]]>
https://discuss.wxpython.org/t/glcanvas-systemerror-built-in-function-isdisplaysupported-returned-a-result-with-an-exception-set/40419#post_1 Thu, 05 Mar 2026 09:26:24 +0000 discuss.wxpython.org-post-126483
wxDataViewListCtrl sizing questions Well, I accidentally found the magic incantation to make it work in wxFormBuilder, and learned something important about how nesting works. It appears wxFormBuilder wants every container to embed a sizer at the container’s top level, and children of the container must live inside the sizer. Once I got to that point it all works as expected.

In my non-working initial example I had sizers directly nested within sizers. I understand this is supposed to be allowed, but in this case must have confused some part of the layout code.

Thanks for taking the time to treat my question seriously, your example helped.

]]>
https://discuss.wxpython.org/t/wxdataviewlistctrl-sizing-questions/40416#post_8 Sun, 22 Feb 2026 20:18:04 +0000 discuss.wxpython.org-post-126480
wxDataViewListCtrl sizing questions
RichardT:

I used wxGlade to initially create my example. It automatically adds a Panel to every Frame.

The panel handles keyboard navigation (e.g. the Tab key). Also, a frame without a panel has a different background colour on some systems, e.g. on Windows.
From looking at the example above, it seems that wxFormbuilder requires a sizer ‘between’ frame and panel. wxGlade did so until some years ago and I have removed this as it was really odd.

]]>
https://discuss.wxpython.org/t/wxdataviewlistctrl-sizing-questions/40416#post_7 Sun, 22 Feb 2026 11:49:08 +0000 discuss.wxpython.org-post-126479
wxDataViewListCtrl sizing questions I modified my example to remove the top level panel that wxGlade adds and that version works the same as the original. That makes me think that it is added because it helps on other OS.

wxGlade does not directly support the DataViewListCtrl. What I do for unsupported controls is add a “custom widget” and then set it to the required class. See the documentation at Custom Widget — wxGlade 1.1.1 documentation

]]>
https://discuss.wxpython.org/t/wxdataviewlistctrl-sizing-questions/40416#post_6 Sat, 21 Feb 2026 21:40:15 +0000 discuss.wxpython.org-post-126478
wxDataViewListCtrl sizing questions Thanks for checking that out.

I have a Linux system as well and I’ll try it there. If I get the same results as you I guess I’ll file a bug, but it’s not clear against which component. Could be the Windows versions of wxWidgets or wxPython.

Also I’ll check out wxGlade. Thanks again.

]]>
https://discuss.wxpython.org/t/wxdataviewlistctrl-sizing-questions/40416#post_5 Sat, 21 Feb 2026 21:30:47 +0000 discuss.wxpython.org-post-126477
wxDataViewListCtrl sizing questions I used wxGlade to initially create my example. It automatically adds a Panel to every Frame. I seem to remember reading that there are good reasons for doing so, but my failing memory can’t recall them.

Edit: when I run your example on my linux PC it does show the data items:

Edit2: when I added wx.EXPAND to this line:

bSizer4.Add( self.dvRegList, 1, wx.EXPAND|wx.ALL, 5 )

then dvRegList expanded vertically:

]]>
https://discuss.wxpython.org/t/wxdataviewlistctrl-sizing-questions/40416#post_4 Sat, 21 Feb 2026 20:38:06 +0000 discuss.wxpython.org-post-126476
wxDataViewListCtrl sizing questions Well, there’s clearly a lot I’m missing here, and wxFormBuilder isn’t helping.

You have a top-level panel as a child of the frame, and wxFormBuilder won’t allow that.
Here’s what I see in wxFormBuilder:

The displayed window looks identical to what wxFormBuilder previews but I can’t add a second image.

The code generated by wxFormBuilder:

# -*- coding: utf-8 -*-

###########################################################################
## Python code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
## http://www.wxformbuilder.org/
##
## PLEASE DO *NOT* EDIT THIS FILE!
###########################################################################

import wx
import wx.xrc
import wx.dataview

import gettext
_ = gettext.gettext

###########################################################################
## Class Sample2FrameBase
###########################################################################

class Sample2FrameBase ( wx.Frame ):

    def __init__( self, parent ):
        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 571,369 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )

        self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )

        bSizer1 = wx.BoxSizer( wx.VERTICAL )

        bSizer2 = wx.BoxSizer( wx.HORIZONTAL )

        self.m_panel2 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
        self.m_panel2.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOW ) )
        self.m_panel2.SetBackgroundColour( wx.Colour( 128, 255, 255 ) )

        bSizer2.Add( self.m_panel2, 1, wx.EXPAND |wx.ALL, 5 )


        bSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )

        bSizer3 = wx.BoxSizer( wx.VERTICAL )

        self.m_panel3 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
        self.m_panel3.SetBackgroundColour( wx.Colour( 255, 128, 64 ) )

        bSizer3.Add( self.m_panel3, 1, wx.EXPAND |wx.ALL, 5 )


        bSizer1.Add( bSizer3, 1, wx.EXPAND, 5 )

        bSizer4 = wx.BoxSizer( wx.HORIZONTAL )

        self.dvRegList = wx.dataview.DataViewListCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.dataview.DV_ROW_LINES )
        self.cRegType = self.dvRegList.AppendTextColumn( _(u"Type"), wx.dataview.DATAVIEW_CELL_ACTIVATABLE, -1, wx.ALIGN_LEFT, wx.dataview.DATAVIEW_COL_RESIZABLE )
        self.cWaitList = self.dvRegList.AppendTextColumn( _(u"W"), wx.dataview.DATAVIEW_CELL_INERT, -1, wx.ALIGN_LEFT, wx.dataview.DATAVIEW_COL_RESIZABLE )
        self.cRegName = self.dvRegList.AppendTextColumn( _(u"Name"), wx.dataview.DATAVIEW_CELL_INERT, -1, wx.ALIGN_LEFT, wx.dataview.DATAVIEW_COL_RESIZABLE )
        bSizer4.Add( self.dvRegList, 1, wx.ALL, 5 )


        bSizer1.Add( bSizer4, 3, wx.EXPAND, 5 )


        self.SetSizer( bSizer1 )
        self.Layout()

        self.Centre( wx.BOTH )

    def __del__( self ):
        pass

And the main program:

import Sample
import wx

class Sample2Frame(Sample.Sample2FrameBase):
    def __init__(self, parent):
        super(Sample2Frame, self).__init__(parent)
    def OnQuit(self, event):
        self.Close(True)

app = wx.App()
frm = Sample2Frame(None)

frm.dvRegList.AppendItem(["Type 1", "N", "John Doe"])
frm.dvRegList.AppendItem(["Type 2", "N", "Fred Bloggs"])
frm.dvRegList.AppendItem(["Type 1", "N", "Jane Doe"])

frm.Show()
frm.dvRegList.Refresh()

app.MainLoop()

]]>
https://discuss.wxpython.org/t/wxdataviewlistctrl-sizing-questions/40416#post_3 Sat, 21 Feb 2026 20:27:41 +0000 discuss.wxpython.org-post-126475
Detected Dark / Light / System mode Does darkdetect (Client Challenge) help?

]]>
https://discuss.wxpython.org/t/detected-dark-light-system-mode/40410#post_6 Sat, 21 Feb 2026 17:02:14 +0000 discuss.wxpython.org-post-126474
wxDataViewListCtrl sizing questions To try to understand the issue, I have tried to create some example code. I put panels with distinct background colours in bSizer2 and bSizer3 to make it more obvious where they are located.

In the example it didn’t seem to make any difference if bSizer4 was horizontal or vertical, dvRegList is displayed and resizes as I would expect, but perhaps I am not understanding the problem.

import wx
import wx.dataview as dv

class MyFrame(wx.Frame):
    def __init__(self, *args, **kwds):
        wx.Frame.__init__(self, *args, **kwds)

        self.panel1 = wx.Panel(self, wx.ID_ANY)
        bsizer1 = wx.BoxSizer(wx.VERTICAL)
        bsizer2 = wx.BoxSizer(wx.HORIZONTAL)
        bsizer1.Add(bsizer2, 1, wx.EXPAND, 0)
        self.panel2 = wx.Panel(self.panel1, wx.ID_ANY)
        self.panel2.SetBackgroundColour(wx.Colour(0, 127, 255))
        bsizer2.Add(self.panel2, 1, wx.EXPAND, 0)
        bsizer3 = wx.BoxSizer(wx.VERTICAL)
        bsizer1.Add(bsizer3, 1, wx.EXPAND, 0)
        self.panel3 = wx.Panel(self.panel1, wx.ID_ANY)
        self.panel3.SetBackgroundColour(wx.Colour(127, 255, 0))
        bsizer3.Add(self.panel3, 1, wx.EXPAND, 0)
        bsizer4 = wx.BoxSizer(wx.VERTICAL)
        bsizer1.Add(bsizer4, 3, wx.EXPAND, 0)
        self.dvRegList = dv.DataViewListCtrl(self.panel1, wx.ID_ANY, style=dv.DV_HORIZ_RULES|dv.DV_VERT_RULES)
        bsizer4.Add(self.dvRegList, 1, wx.EXPAND, 0)
        self.panel1.SetSizer(bsizer1)
        self.Layout()
        
        for c in range(3):
            self.dvRegList.AppendTextColumn(f"Column {c+1}")
            
        self.dvRegList.AppendItem(["1", "2", "3"])
        self.dvRegList.AppendItem(["4", "5", "6"])
        

if __name__ == "__main__":
    app = wx.App()
    frame = MyFrame(None, wx.ID_ANY, "DataViewList Layout", size=(400, 300))
    frame.Show()
    app.MainLoop()

Tested using: wxPython 4.2.5 gtk3 (phoenix) wxWidgets 3.2.9 + Python 3.12.3 + Linux Mint 22.3

]]>
https://discuss.wxpython.org/t/wxdataviewlistctrl-sizing-questions/40416#post_2 Sat, 21 Feb 2026 11:37:24 +0000 discuss.wxpython.org-post-126473
wxDataViewListCtrl sizing questions I’m having trouble understanding how a DataViewListCtrl is sized.

I have created a Frame in wxFormBuilder with the following nested BoxSizer structure:

  • bSizer1 (Vertical)
    • bSizer2 (Horizontal, proportion 1)
    • bSizer3 (Vertical, proportion 1)
    • bSizer4 (Horizontal, proportion 3)
      • DataViewListCtrl (name dvRegList)
        • DataViewListColumn
        • DataViewListColumn
        • DataViewListColumn

If bSizer4 is Vertical orientation, dvRegList does not expand horizontally to fill the sizer. It’s just a tiny border on the far left of the sizer, the height of the header row and just a few pixels wide. This is surprising because a button and static text in a vertical sizer display normally.

If bSizer4 is Horizontal, dvRegList expands horizontally but displays only the header, with none of the rows, even if I resize the window so that there’s obviously room for the rows.

The only way I can get it to display rows is to set a minimum height, and when I do it now behaves as expected… it fills its sizer both vertically and horizontally, and resizes with the window.

So I have 2 questions:

  • Why does the DataViewListCtrl not fill the sizer when the sizer’s orientation is Vertical
  • Why (when the sizer is Horizontal) does it need to have an explicit minimum vertical height set.

I would have expected the control to fill its sizer by default, and I can’t find anything in the docs that specifies the observed behavior.

I’m sure I’m missing something obvious, but would like to know where this is documented.

Thanks

]]>
https://discuss.wxpython.org/t/wxdataviewlistctrl-sizing-questions/40416#post_1 Fri, 20 Feb 2026 19:28:21 +0000 discuss.wxpython.org-post-126472
Detected Dark / Light / System mode Karsten / swt2c,
Thank you for this information.

test__dark_mode.py (5.4 KB)

After consulting the wxWidgets documentation and making a modification for Linux, I tried to enable dark mode on Windows with “w**xpython-4.3.0a16030”, unfortunately without success.

]]>
https://discuss.wxpython.org/t/detected-dark-light-system-mode/40410#post_5 Sat, 14 Feb 2026 16:38:49 +0000 discuss.wxpython.org-post-126470
ScrollWindow doesn't display until after scroll this is usually just a repaint/layout issue with wx.ScrolledWindow.

after you populate it, make sure you’ve called:

  • SetScrollRate(...)
  • Layout()
  • FitInside() (if using sizers)
  • and optionally Refresh() / Update()

also if you’re drawing manually, set SetVirtualSize() before showing the frame.

what’s happening is nothing triggers an initial paint, and the first scroll forces one — that’s why it suddenly appears. classic Scrolled Window Behaviour.

]]>
https://discuss.wxpython.org/t/scrollwindow-doesnt-display-until-after-scroll/40402#post_5 Fri, 13 Feb 2026 14:29:04 +0000 discuss.wxpython.org-post-126468
TypeError: copy_file() takes from 2 to 7 positional arguments but 8 were given Also, I just released wxPython v4.2.5 which should resolve this issue as well.

]]>
https://discuss.wxpython.org/t/typeerror-copy-file-takes-from-2-to-7-positional-arguments-but-8-were-given/40408#post_11 Sun, 08 Feb 2026 20:47:34 +0000 discuss.wxpython.org-post-126464
TypeError: copy_file() takes from 2 to 7 positional arguments but 8 were given Thanks a lot swt2c, your workaround saves my night :slight_smile:
Problem solved :+1:

]]>
https://discuss.wxpython.org/t/typeerror-copy-file-takes-from-2-to-7-positional-arguments-but-8-were-given/40408#post_10 Sun, 08 Feb 2026 17:22:07 +0000 discuss.wxpython.org-post-126463
Detected Dark / Light / System mode @Zig_Zag you may want to read the wxWidgets documentation for now until wxPython documentation is updated. Note the MSW specifics there about IsDark().

https://docs.wxwidgets.org/latest/classwx_system_appearance.html

]]>
https://discuss.wxpython.org/t/detected-dark-light-system-mode/40410#post_4 Sun, 08 Feb 2026 15:02:43 +0000 discuss.wxpython.org-post-126462