简体   繁体   中英

python error using tkinter root is not defined

I am trying to use tkinter in python.

I imported tkinter using from tkinter import TK and I defined root root = TK()

I use python-3 and I work on a Linux ubuntu I also did install tkinter but it keeps giving me following error:

这是错误的屏幕截图

I am not too experienced with python yet. Please help me.

The better way is to use this one import tkinter as tk instead of from tkinter import TK

like this image.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM