I have a simple wxPython app showing a screenshot in fullscreen. The screenshot resolution matches the actual resolution of the monitor, however after changing the scaling setting in Windows the image is being displayed too large and doesn't fit the screen anymore. How can I change the scale of the image back to original?
class Window(wx.Frame):
def __init__(self, image: PIL.Image):
wx.Frame.__init__(self, None, wx.ID_ANY, "app_name")
width, height = image.size
image = wx.Image(width=width, height=height, data=image.tobytes())
self.image = image.ConvertToBitmap()
self.Bind(wx.EVT_PAINT, self._on_paint)
self.ShowFullScreen(True)
def _on_paint(self, event):
dc = wx.PaintDC(self)
brush = wx.Brush(self.image)
dc.SetBackground(brush)
dc.Clear()
I have tried image.Rescale(*wx.GetDisplaySize()), which works to bring the image back to original size, but it looks low resolution.
from How to resize background image in PaintDC in wxPython?
No comments:
Post a Comment