【发布时间】:2020-11-12 19:13:29
【问题描述】:
我将Tkinter 与GUI 一起使用,并使用根窗口内的按钮。
我还想在MatplotLib 图表中使用Button,它允许我退出图表(并且将来可能用于其他用途)。
唯一的问题是它们都使用相同的标签Button。这两个标签有不同的语法,所以我只能有Tkinter 按钮或Matplotlib 按钮。
我确定这是一个非常业余的问题,但有没有办法指定这个 Button 是一个 tkinter 按钮,而另一个 Button 是一个 matplotlib 按钮?
下面是代码示例:
from matplotlib.widgets import Slider, Button, RadioButtons
from tkinter import *
btn = Button(root, text="Plot", command=graph).pack()
【问题讨论】:
-
这就是为什么你不应该使用通配符导入。
标签: python matplotlib tkinter syntax