有没有办法让函数与 easygui 整数盒正确交互?

Is there a way to get functions to interact correctly with easygui integerbox?

提问人:Ryan 提问时间:10/5/2023 最后编辑:petezurichRyan 更新时间:10/5/2023 访问量:8

问:

当我在函数中使用 easygui.integerbox 定义变量时,当变量在 print() 中使用时,它不是整数,而是“None”。它也不允许我的上限高于 99,即使我将其更改为上限 = 999。

import easygui

def intpage(content):
easygui.integerbox(content)

num = intpage("number")

print(num)

当我使用 easygui 的输入框时,它工作正常,那么为什么不使用整数框呢?我不能使用输入框而不是整数框,因为我需要变量值采用整数格式,而不是任何其他非整数字符。

import easygui,

def entpage(content):
easygui.enterbox(content)

words = entpage("Words")

print(words)

有没有人对为什么会发生这种情况有任何想法,以及任何解决方案?(此外,关于如何正确增加上限的任何想法都会很好。>

python 函数 变量 easygui

评论


答: 暂无答案