|
发表于 2020-6-12 06:23:15
|
显示全部楼层
本楼为最佳答案
 这个需要修改包了,需要修改python目录下Lib\site-packages\easygui\boxes中的choice_box.py,修改其中两个模块create_ok_button和create_cancel_button,修改前做好备份:
- def create_ok_button(self):
- self.buttonsFrame = tk.Frame(self.boxRoot)
- self.buttonsFrame.pack(side=tk.TOP, expand=tk.YES, pady=0)
- # put the buttons in the self.buttonsFrame
- # okButton = tk.Button(self.buttonsFrame, takefocus=tk.YES,
- # text="OK", height=1, width=6)
- okButton = tk.Button(self.buttonsFrame, takefocus=tk.YES,
- text="确认", height=1, width=6) #<----修改text改变按钮文字
- bindArrows(okButton)
- # okButton.pack(expand=tk.NO, side=tk.RIGHT, padx='2m', pady='1m',
- # ipady="1m", ipadx="2m")
- okButton.pack(expand=tk.NO, side=tk.LEFT, padx='2m', pady='1m', #<---修改side改变按钮位置
- ipady="1m", ipadx="2m")
- # for the commandButton, bind activation events
- okButton.bind("<Return>", self.ok_pressed)
- okButton.bind("<Button-1>", self.ok_pressed)
- okButton.bind("<space>", self.ok_pressed)
- def create_cancel_button(self):
- # cancelButton = tk.Button(self.buttonsFrame, takefocus=tk.YES,
- # text="Cancel", height=1, width=6)
- cancelButton = tk.Button(self.buttonsFrame, takefocus=tk.YES,
- text="取消", height=1, width=6) #<----修改text改变按钮文字
- bindArrows(cancelButton)
- # cancelButton.pack(expand=tk.NO, side=tk.LEFT, padx='2m', pady='1m',
- # ipady="1m", ipadx="2m")
- cancelButton.pack(expand=tk.NO, side=tk.RIGHT, padx='2m', pady='1m', #<---修改side改变按钮位置
- ipady="1m", ipadx="2m")
- cancelButton.bind("<Return>", self.cancel_pressed)
- cancelButton.bind("<Button-1>", self.cancel_pressed)
- # self.cancelButton.bind("<Escape>", self.cancel_pressed)
- # for the commandButton, bind activation events to the activation event
- # handler
复制代码
修改后的效果:
|
|