You are not logged in.
Pages: 1
I already ran
$ sudo pacman -S tk
and
import tkinter as tk
works perfectly in python.
But after coding a plot, no output is created.
$ pip install tkinter
returns
Collecting tkinter
Could not find a version that satisfies the requirement tkinter (from versions: )
No matching distribution found for tkinter
How can I get tkinter working?
Last edited by AeonSiraus (2017-03-26 21:14:39)
Offline
It would help if you described the actual problem. You've described how you've installed tk - attempting both via pacman and pip. You should use one or the other not both. Tk in installaed via pacman, so that can be checked off the list.
So then what's the actual problem? As you give is "after coding a plot, no output is created." What does this mean? Where is your code? What kind of plot do you expect? What output do you think should be created?
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Online
The code I ran was:
import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.ylabel('some numbers')
plt.show()
from which a graph of x=y should be generated,
but no output is geneatedn meaning no tk window opens, no error messages appear and python exits.
Last edited by AeonSiraus (2017-03-26 20:11:10)
Offline
Update: neither tkinter nor tk were to blame. Matplotlib backend was not correct. Adding
matplotlib.use('TKagg')
solved the problem. If anyone experiences this problem or a similar one, check your backends.
Tags: Matplotlib not displaying, no output matplotlib, no plot python
Last edited by AeonSiraus (2017-03-26 21:16:37)
Offline
Pages: 1