TKINTER MESSAGEBOX错误警告:预期的最小视图高度?? (MacOS)

发布于 2025-01-22 16:35:41 字数 1632 浏览 2 评论 0 原文

在这里开始是一些背景信息: Python版本3.9.10 64bit TKINTER V8.6 Macos Monterey 12.3.1 简而言之,

我正在尝试学习tkinter模块。一切正常,除了我尝试使用MessageBox时。它引发了一个错误,到目前为止,我还没有找到任何可以帮助我的东西。我尝试卸载并重新安装了TKINTER和MACVIM,但没有成功。请让我知道你们发现的! (当最初运行代码以及按按钮启动时出现错误)

错误代码: (base)rutemauro@caios-mac-book cps121%cd/users/rutemauro/desktop/cps121; /usr/bin/env/usr/local/bin/python3/users/rut emauro/.vscode/extensions/ms-python.python-2022.4.1/pythonfiles/lib/python/python/debugpy/启动器54603-/users/rutemauro/desktop /cps121/python-practice/tkinter-gui/logintemplate.py 2022-04-20 01:05:35.263 Python [2534:43780]警告:预期的最小视图高度:(< nsbutton:0x7fc31191aab0>)的高度要小于或等于30.32.000000。每个视图都会以违规方式记录此错误。 2022-04-20 01:05:36.342 Python[2534:43780] Warning: E​​xpected min height of view: () to be less than or equal to 30 but got a height of 32.000000. 它是一个简单的登录表单,因此该错误将被记录一次。

这是重要的代码:

#Login Function
def loginFunc():
    if usernameEntry.get() == 0:
        messagebox.showerror("login unsuccessful", "Please Enter a Password")
    elif passwordEntry.get() == 0:
        messagebox.showerror("login unsuccessful", "Please Enter a Password")
    else:
        messagebox.showinfo("login successful", "You have successfully been logged in")


#Login Button
loginButton = Button(root, text="Login", font=("Arial",16), command=loginFunc)
loginButton.pack(pady=20)

github到完整代码(我认为):https://gist.github.com/caiomauro/1abc39c5f2826d18e78555ec776df6b4

To start here is some background information:
Python Version 3.9.10 64bit
TkInter v8.6
macOS Monterey 12.3.1
Running from VS Code

In short I am trying to learn the TkInter module. Everything works well except when I try to use messagebox. It throws an error and so far I haven't found anything to help me out. I have tried uninstalling and reinstalling a tkinter and macvim with no success. Please let me know what you guys find! (Error appears when initially running code and when initiate by the button)

Error Code:
(base) rutemauro@Caios-Mac-Book cps121 % cd /Users/rutemauro/Desktop/cps121 ; /usr/bin/env /usr/local/bin/python3 /Users/rut
emauro/.vscode/extensions/ms-python.python-2022.4.1/pythonFiles/lib/python/debugpy/launcher 54603 -- /Users/rutemauro/Desktop
/cps121/python-practice/TkInter-GUI/loginTemplate.py
2022-04-20 01:05:35.263 Python[2534:43780] Warning: Expected min height of view: (<NSButton: 0x7fc31191aab0>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.
2022-04-20 01:05:36.342 Python[2534:43780] Warning: Expected min height of view: (<NSButton: 0x7fc311a59fe0>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.

Its a simple login form so here is the code that matters:

#Login Function
def loginFunc():
    if usernameEntry.get() == 0:
        messagebox.showerror("login unsuccessful", "Please Enter a Password")
    elif passwordEntry.get() == 0:
        messagebox.showerror("login unsuccessful", "Please Enter a Password")
    else:
        messagebox.showinfo("login successful", "You have successfully been logged in")


#Login Button
loginButton = Button(root, text="Login", font=("Arial",16), command=loginFunc)
loginButton.pack(pady=20)

github to full code (i think): https://gist.github.com/caiomauro/1abc39c5f2826d18e78555ec776df6b4

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文