2 years ago
#46702
vacexpfleger
How to split class into multiple modules in Python?
Trying to code a music player in Python (not really convenient ik) just to clarify some concepts of OOP and mainly for fun. I'd like to split the class into multiple modules, in particular methods like play, stop, next etc. Could anyone explain how to do that? Thanks in advance. Code here
class App(tk.Tk):
NAME = "Improved Disco"
WIDTH = 700
HEIGHT = 500
PATH = os.path.dirname(os.path.realpath(__file__))
def __init__(self):
super().__init__()
self.title(App.NAME)
self.geometry(str(App.WIDTH) + "x" + str(App.HEIGHT))
# self.minsize(App.WIDTH, App.HEIGHT)
self.resizable(False, False)
self.iconphoto(False, tk.PhotoImage(file='music_player.png'))
...
def add_songs(self):
...
def play(self):
...
python
oop
audio-player
0 Answers
Your Answer