Message353359
TkInter variable classes don't link to a widget (tested on Checkbutton and Scale) if matplotlib.pyplot.set_cmap() function is called before the tkinter.Tk() call which instantiates the root of a TkInter GUI. There is no problem if it is called after this, though.
Simple example with checkbox attached below:
### Test program start ##############
import matplotlib.pyplot as plt
import tkinter as tk
plt.set_cmap('viridis') # <--- when placed here, breaks the variable
root = tk.Tk()
#plt.set_cmap('viridis') # <--- when placed here, everything is fine
# creation of variable class and widget
var = tk.BooleanVar()
tk.Checkbutton(root, variable=var).pack()
# for printing result
def on_click():
print(var.get())
tk.Button(root, text="Print State to Console", command=on_click).pack()
root.mainloop() |
|
Date |
User |
Action |
Args |
2019-09-27 13:20:38 | amiraliemami | set | recipients:
+ amiraliemami |
2019-09-27 13:20:38 | amiraliemami | set | messageid: <1569590438.84.0.268389191233.issue38292@roundup.psfhosted.org> |
2019-09-27 13:20:38 | amiraliemami | link | issue38292 messages |
2019-09-27 13:20:38 | amiraliemami | create | |
|