在windows系统中,python使用messagebox时发生 AttributeError: module 'tkinter' has no attribute 'messagebox' 错误,解决方法为再单独导入messagebox模块即可解决报错。

#!/usr/bin/python
# -*- coding: utf-8 -*-

#导入tkinter模块
import tkinter

# 报错解决方法,再导入下面模块
from tkinter import messagebox

 

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐