在pycharm中创建的gui没有运行?

编程入门 行业动态 更新时间:2024-10-27 21:22:06
本文介绍了在pycharm中创建的gui没有运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

无法执行脚本pyi_rth_tkinter

Failed to execute script pyi_rth_tkinter

我在 pycharm 中创建了一个 gui 并通过 pyinstaller 安装 n 它显示成功但每当我尝试打开它时都会弹出这样的消息.由于我在编码方面很新,请帮助我**从 tkinter 导入 *

I created a gui in pycharm and install through pyinstaller n it shows successfull but whenever i try to open it pops out message like this. As i am very new in coding please help me** from tkinter import *

root  = Tk()
root.geometry("400x400")
root.title("Barcode finder")

dict = {"206621":["nescafe red mug solubale coffee 100gr","7616100997329","nestle", "25aed"]}

def barcode():
    x = e.get()
    value = dict.get(x)

    if value:
        decision.configure(text = value)

    else:
        decision.configure(text = "barocde not found")

mylabel = Label(root, text = "Enter barcode", fg = "red", bg ="blue", padx = 40 , pady = 20)
mylabel.pack()

e = Entry(root, width= 20, )
e.pack()

mylabel2 = Button(root, text = "Submit", padx = 10, pady = 10, command = barcode)
mylabel2.pack ()

decision = Label(root, text = "", font =("Ariel Bold", 10))
decision.pack()

root.mainloop()

推荐答案

您可以添加此 pyinstaller 代码,使您的 tkinter 代码适用于 macOS.

You can add this pyinstaller code for your tkinter code to work for macOS.

pyinstaller --onefile -w --add-binary='/System/Library/Frameworks/Tk.framework/Tk':'tk' --add-binary='/System/Library/Frameworks/Tcl.framework/Tcl':'tcl' your_script.py

这就是 macOS 中的情况,您只需要执行这些操作即可.

This is how it is in macOS, you just have to do these.

希望这有帮助

这篇关于在pycharm中创建的gui没有运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 06:07:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1390557.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:pycharm   gui

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!