Skip to main content
 首页 » 编程设计

Python:Easygui 窗口大小

2024年08月28日37cmt

我正在 EasyGUI 中为我的 python 脚本创建一个 GUI。有谁知道我可以更改默认窗口大小的方法吗?默认值太大了。

感谢您的帮助。

请您参考如下方法:

在安装之前打开 easygui.py 并编辑您想要其他尺寸的元素。 (您也可以重新安装并覆盖它) 这将像

boxRoot.minsize(root_width, root_height) 

在相应的函数中。
为了更加灵活,将宽度和高度添加为函数的参数。

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)