首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NameError:在Python3中未使用myqr和easygui定义名称“QRCreator”

NameError:在Python3中未使用myqr和easygui定义名称“QRCreator”
EN

Stack Overflow用户
提问于 2018-02-22 02:45:04
回答 1查看 418关注 0票数 0

我正在使用python中的easygui和myqr来制作看起来很酷的二维码,我使用的代码来自Linux格式杂志。所有的代码都会一直运行到最后一行。

代码语言:javascript
复制
#QRCodeGenarator.py
import easygui as eg
from MyQR import myqr

def QrCreator(URL, image, save):         

version, level, qr_name = myqr.run(

URL,
version = 1,
level = 'H',
picture= image,
colorized = True,
contrast = 1.0,
brightness = 1.0,
save_name = save,
save_dir="/Desktop/QRCodes"
)

URL = eg.enterbox(msg = "Please provide the URL for the QR code", title "Specify URL for QR code")
print(URL)

image = eg.fileopenbox(msg = "What image shall I use with the QR code?", title = "Open Image", default="/Desktop/QRCodes")
print(image)

save = eg.filesavebox(msg = "Save QR code as ?", default="/Desktop/QRCodes")
print(save)

eg.msgbox(msg="Your QR code has been saved!", title = "Save Complete")

QRCreator(URL, image, save)

错误出现在代码的最后一行

代码语言:javascript
复制
QRCreator(URL, image, save)

IDLE3中的错误如下所示

代码语言:javascript
复制
Traceback (most recent call last):
  File "/home/nyle/QRCodeGenarator.py", line 30, in <module>
    QRCreator(URL, image, save)
NameError: name 'QRCreator' is not defined
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-02-25 06:52:08

def QrCreator(URL, image, save):更改为def QRCreator(URL, image, save):

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48913265

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档