I am receiving an exception which implies a problem with my inheritance structure, but cannot figure out the problem.
import tkinter as tk
class Game(tk.Tk):
class Period(tk.Frame, Game):
class PeriodSummary(tk.Frame,Period):
This gives the excpetion:
Traceback (most recent call last):
File "tkinter_test.py", line 4, in <module>
class PeriodSummary(tk.Frame,Period):
TypeError: Cannot create a consistent method resolution
order (MRO) for bases Frame, Period
So I want to have Period to inherit attributes from Game, and PeriodSummary to inherit attributes from Period. Why is this not possible?
PeriodSummaryneed to inherit from these other classes? Why are s aPeriodalso aGameinstead of being part of a game? What do you think that accomplishes?Gamehas manyPeriods. After each Period is played, I would like there to be aPeriodSummaryframe come up.Periodinherits fromGamebecause it needs attributes from it, but has also differet attributes.Gameobject should have severalPeriodobjects as attributes. You don't want to use inheritance just because you need to share data, that's not what inheritance is for.