I am trying to see if a bool is true or false in a function but the program only returns SyntaxWarning: 'bool' object is not callable; perhaps you missed a comma? if Pianobool == True(): and this TypeError: 'bool' object is not callable When I look at it it looks like the bools are being assigned above the function. The bools are located pretty far down I just wanted to include all code because maybe it has to do with something else.
from faulthandler import dump_traceback
from tkinter import *
from playsound import playsound
import multiprocessing
import os
from multiprocessing import Process
import keyboard
root = Tk()
def Piano():
playsound(r'F:\Backup\Game.Develop\In.Develop\numbe.py\STEMOPLAYER/Piano.mp3')
def Vocals():
playsound(r'F:\Backup\Game.Develop\In.Develop\numbe.py\STEMOPLAYER/Vocals.mp3')
def Drums():
playsound(r'F:\Backup\Game.Develop\In.Develop\numbe.py\STEMOPLAYER/Drum.mp3')
def Guitar():
playsound(r'F:\Backup\Game.Develop\In.Develop\numbe.py\STEMOPLAYER/Guitar.mp3')
if __name__ == '__main__':
p = multiprocessing.Process(target=Piano)
D = multiprocessing.Process(target=Drums)
V = multiprocessing.Process(target=Vocals)
G= multiprocessing.Process(target=Guitar)
Pianobool = False
Guitarbool = False
Drumbool = False
Vocalbool = False
def PlayPiano():
if Pianobool == True():
p.terminate()
Pianobool = False
elif Pianobool == False():
p.start()
Pianobool = True
Pianobutton = Button(root,text='Piano',command=(PlayPiano))
Pianobutton.pack()
Guitarbutton = Button(root,text='Guitar')
Guitarbutton.pack()
Drumbutton = Button(root,text='Drums')
Drumbutton.pack()
Vocalbutton = Button(root,text='Vocals')
Vocalbutton.pack()
root.mainloop()