forked from Aashishkumar123/Python-GUI-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6345e37
commit cca0427
Showing
25 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from tkinter import * | ||
import tkinter as tk | ||
from PIL import ImageTk, Image | ||
from playsound import playsound | ||
root = tk.Tk() | ||
root.geometry('700x300') | ||
root.title("piano") | ||
root.maxsize(700,300) | ||
root.minsize(700,300) | ||
root['bg']="white" | ||
icon = ImageTk.PhotoImage(Image.open('piano.png')) | ||
icon_label = Label(root,image=icon) | ||
icon_label.place(x=295,y=10) | ||
frame1 = Frame(root,width=700,height=198,bg="white") | ||
frame1.place(x=0,y=100) | ||
class piano(): | ||
def PianoSound(self,sound): | ||
playsound(f'Piano{sound}.mp3') | ||
def __init__(self,index): | ||
self.index = index | ||
if self.index%2 != 0: | ||
Button(frame1,padx=10,pady=100,bg="black",fg="white",relief=RAISED,borderwidth=3,command=lambda:self.PianoSound(self.index),cursor="hand2").grid(row=0,column=self.index) | ||
else: | ||
Button(frame1,padx=10,pady=100,bg="white",fg="black",relief=RAISED,borderwidth=2,command=lambda:self.PianoSound(self.index),cursor="hand2").grid(row=0,column=self.index) | ||
if __name__ == '__main__': | ||
for i in range(1,24): | ||
piano(i) | ||
root.mainloop() | ||
|
||
|
||
|
||
|