Skip to content

Low-res checkbox images in CheckListBox #963

@feerrenrut

Description

@feerrenrut

Operating system: Windows 10 Version 10.0.17134 Build 17134
wxPython version: 4.03
Stock or custom build: Stock
Python version: 2.7.14
Stock or custom build: Stock

Description of the problem:
On a system with 125% or more scaling (Display settings, "change the size of text, apps and other items"). When using ctypes.windll.user32.SetProcessDPIAware() with CheckListBox the check marks seems to have scaling issues.

This is related to #835 ("Low-res checkbox images ChecklistCtrlMixin"), but I believe a new issue should be created due to differences in OS, the exact control in question, and the relevance of SetProcessDPIAware. I also tested CheckListCtrlMixin and could not reproduce the same issue.

This can be demonstrated by including the following at the top of the CheckListBox wxPython demo:

import ctypes
ctypes.windll.user32.SetProcessDPIAware()

And full demo code:

import ctypes
ctypes.windll.user32.SetProcessDPIAware()
import wx

class TestPanel(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1)

        sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
                      'six', 'seven', 'eight', 'nine', 'ten', 'eleven',
                      'twelve', 'thirteen', 'fourteen']

        lb = wx.CheckListBox(self, -1, (80, 50), wx.DefaultSize, sampleList)
        lb.SetSelection(0)
        lb.SetCheckedItems([1,])
        self.lb = lb

#----------------------------------------------------------------------

class RunDemoApp(wx.App):
    def __init__(self):
        wx.App.__init__(self, redirect=False)


    def OnInit(self):
        frame = wx.Frame(None, -1, "test", pos=(50,50), size=(200,100),
                        style=wx.DEFAULT_FRAME_STYLE, name="test")
        frame.Show(True)
        win = TestPanel(frame)

        # so set the frame to a good size for showing stuff
        frame.SetSize((640, 480))
        win.SetFocus()
        self.window = win

        self.SetTopWindow(frame)
        self.frame = frame

        return True

    def OnExitApp(self, evt):
        self.frame.Close(True)


if __name__ == "__main__":
    app = RunDemoApp()
    app.MainLoop()

Which produces the following, first with the call to SetProcessDPIAware and then without:
image

image

The following is a screenshot comparing the check mark of CheckListCtrlMixin with CheckListBox, produced with code available in a gist.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions