Reputation: 1416
I'm creating a GUI for my python script in EasyGUI. Does anyone know of a way I can change the default Window size? The default is far too big.
Thanks for your help.
Upvotes: 2
Views: 6235
Reputation: 11
I pseudo-pulled the code from GitHub to mess with the choicebox because of the size problem and I did the following .... I don't know if this is a good fix or not but it seemed to work to make at least the width of the screen variable according to the length of msg, title, and list of choices:
... choices = list(choices[:])
choiceLen = len(max(choices,key=len))
titleLen = len(title)
msgLen = len(msg)
maxLen = max(choiceLen,titleLen,msgLen)
...
root_width = int(maxLen * 10.)
Upvotes: 1
Reputation: 3009
Before install open easygui.py
and edit element you want to have another size. (You can also reinstall and override it)
This will be line like
boxRoot.minsize(root_width, root_height)
in the corresponfing function.
To be more flexible add width and height as parameters to the function.
def __choicebox(msg
, title
, choices
, width_ = 480
, height_ = 320
):
....
root_width = width_
root_height = height_
root_xpos = int((screen_width * 0.1))
root_ypos = int((screen_height * 0.05))
boxRoot.title(title)
boxRoot.iconname('Dialog')
rootWindowPosition = "+0+0"
boxRoot.geometry(rootWindowPosition)
boxRoot.expand=NO
boxRoot.minsize(root_width, root_height)
Upvotes: 2