Python踩坑之 from Tkinter import * 与 import Tkinter 的区别

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/cadi2011/article/details/84637284

 from Tkinter import * 与 import Tkinter 的区别

1、如果是from Tkinter import *

那么你是导入Tkinter下的所有函数、等等、用的时候,省略掉Tkinter即可

OptionMenu(self.root, variable, "one", "two", "three")

2、如果是 import Tkinter,那么不能省略掉模块名Tkinter

Tkinter.OptionMenu(self.root, variable, "one", "two", "three")

猜你喜欢

转载自blog.csdn.net/cadi2011/article/details/84637284