There are virtually no differences between tkinter in 2.x vs 3.x, except for the import statements. This is not a 2.x vs 3.x problem.
The padding
option is only valid for ttk.Frame
, but you're using tkinter.Frame
. For the standard tkinter Frame
widget you have the padx
and pady
options.
manpreet
Best Answer
2 years ago
I've been learning tkinter with the help of a python book. However, the python book is written for python 2 and I'm using python 3. This has generated several errors, and up to now I've been able to fix them, with the aid of other questions here. It is a basic program that shows a window with buttons to play 3 games or to destroy the window. When either of the first two games(rock paper scissors and hangman) are opened, they are supposed to open a Toplevel() that has various buttons that lets you play the game. I haven't written the graphics code for the third game yet. They don't play, though, because of an error: _tkinter.TclError: unknown option "-padding" which I haven't found any detail about online. I understand that the unknown option means that that attribute/keyword doesn't exist in my version of tkinter and python 3. The error lines look like: rpsFrame = Frame(rpsWindow, padding = '3 3 12 12', width = 300)
In case you need it, the error and code are below. (this code doesn't run without additional code) (if you want this code I will add it, but I want to keep this shortish)
Here is the full error traceback:
Here is the interface code: