我正在使用Tkinter GUI创建一个Python桌面应用程序。
代码如下:
from tkinter import *
from tkinter import ttk
import random
import time
import datetime
import tkinter.messagebox
import tkinter.font as Font
# Define Font
titleFont = Font(family="Arial", size="48")
我正在努力思考这个错误是如何造成的:
当我运行titleFont = Font(family="Arial", size="48")
时,我得到:
TypeError: 'module' object is not callable
假设您的代码是导入
tkinter.font
模块(作为Font
)并尝试调用它。但是Python模块是不可调用的。我想您正在尝试从tkinter.font
模块导入Font
。你知道吗注意,您必须首先创建一个根窗口。你知道吗
以下是修订后的代码:
相关问题 更多 >
编程相关推荐