Tkinter & Pycharm console do not work consistenly when it comes to setting up a label's size. Here is a sample code that shows the error :
## Imports
import tkinter as tk
import tkinter.font as font
import pylab
## Main
def test():
root = tk.Tk()
label = tk.Label(master = root, text = "test 1", bg = "lightblue", bd = 5, font = font.Font(size = 15))
label.pack(side = "top", fill = "x")
label = tk.Label(master = root, text = "test 2", bg = "lightblue", bd = 5, font = font.Font(size = 10))
label.pack(side = "top", fill = "x")
root.mainloop()
# test()
If i launch the function test from the console i don't have the same result as if i launch it from the code itself. Which is a bit weird.
Here are screenshots summing up the problem.
(test() is launched from the console)
(test() is launched from the code)
The solution in this post Python modules clashing (tkinter & pylab) leading to weird inconsistency in Pycharm Python console did not work (i assume this little trick works for tk.PhotoImage but not for tk.Label). I could not reproduce the error on Pyzo which is why I assume PyCharm is the problem.
Any help is appreciated.
Thank you for reading me