New submission from Amir Emami <amirali1...@gmail.com>:

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()

----------
components: Tkinter
files: tk and plt conflict.py
messages: 353359
nosy: amiraliemami
priority: normal
severity: normal
status: open
title: tkinter variable classes don't link to widget if matplotlib's set_cmap() 
function is called before the tkinter GUI is instantiated
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file48627/tk and plt conflict.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38292>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to