tkinter - Python, cannot use geometry manager pack inside -
i having several errors after installation of anaconda. when run program message:
tclerror: cannot use geometry manager pack inside . has slaves managed grid
the program written using python 3.3. anaconda version 3.4. don't think there syntax differences between 3.3 , 3.4. searched , not find solution error. don't know means.
thank you.
this error can occur if mix pack()
, grid()
in same master window. according docs, bad idea:
warning: never mix grid , pack in same master window. tkinter happily spend rest of lifetime trying negotiate solution both managers happy with. instead of waiting, kill application, , take @ code. common mistake use wrong parent of widgets.
for example, code working python 3.3.x, isn't working on python 3.4.x (throws error mentioned):
from tkinter import * tkinter import ttk root = tk() mainframe = ttk.frame(root) mainframe.grid(column=0, row=0, sticky=(n, w, e, s)) nb = ttk.notebook(root) nb.pack() root.mainloop()
and code isn't working both python versions:
from tkinter import * root = tk() label(root, text="first").grid(row=0) label(root, text="second").pack() root.mainloop()
to avoid this, use 1 geometry manager children of given parent, such grid()
.
Comments
Post a Comment