MA1
MA1

Reputation: 2847

Automatically adjustment of wxPython Frame Size

How to adjust the wxPython Frame Size automatically when screen resolution change?

Actually, i have just written a wxPython application, currently Frame size is fixed. Due to this application/frame size is very large on some screen resolutions. So, how to resize/adjust automatically depending on the screen resolution size?

Regards,

Upvotes: 0

Views: 4337

Answers (1)

Anurag Uniyal
Anurag Uniyal

Reputation: 88865

Why can't you start app as maximized and let user resize it to whatever size he wants? otherwise if you must set a size based on display size use wx.DisplaySize() to get size of display e.g.

import wx

app = wx.PySimpleApp()
displaySize= wx.DisplaySize()
mainFrame = wx.Frame(None, title="hmmm", size=(displaySize[0]/2, displaySize[1]/2))
mainFrame.Show()
app.SetTopWindow(mainFrame)
app.MainLoop()

Upvotes: 5

Related Questions