File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
src/toga_winforms/widgets Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,16 @@ def set_icon(self, icon):
4848 else :
4949 self .native .Image = None
5050
51+ # Refreshing could change icon DPI, which means that the
52+ # icon should be reassigned by the new scale.
53+ def refresh (self ):
54+ super ().refresh ()
55+ if self ._icon :
56+ self .native .Image = Bitmap (
57+ self ._icon ._impl .bitmap ,
58+ Size (self .scale_in (32 ), self .scale_in (32 )),
59+ )
60+
5161 def set_background_color (self , color ):
5262 super ().set_background_color (
5363 self ._default_background_color if color in {None , TRANSPARENT } else color
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ def assert_no_icon(self):
2020 def assert_icon_size (self ):
2121 icon = self .native .Image
2222 if icon :
23- assert (icon .Size .Width , icon .Size .Height ) == (32 , 32 )
23+ assert (icon .Size .Width , icon .Size .Height ) == (
24+ self .impl .scale_in (32 ),
25+ self .impl .scale_in (32 ),
26+ )
2427 else :
2528 pytest .fail ("Icon does not exist" )
You can’t perform that action at this time.
0 commit comments