Question

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.

Was it helpful?

Solution

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)

OTHER TIPS

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[:])

add lines

choiceLen = len(max(choices,key=len))
titleLen = len(title)
msgLen = len(msg)
maxLen = max(choiceLen,titleLen,msgLen)

...

root_width = int((screen_width * 0.8))

root_width = int(maxLen * 10.)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top