-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbeeveplayer.py
175 lines (145 loc) · 5.86 KB
/
beeveplayer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
from tkinter import *
from tkinter.ttk import *
from src.win10toast.win10toast import ToastNotifier
from random import *
import tkinter as tk
import time
import ctypes
import tkinter.messagebox as mb
import os
import pygame
import tkinter.filedialog as fd
import getpass
def checksetupdone():
f = open("src/config/setup.txt", "r")
fc = f.read()
f.close()
if fc == "not done":
def preferenceusermode(*args):
usermode = darkorwhitemodeVar.get()
preferenceusermodefile = open("src/config/colormode.txt", "w")
preferenceusermodefile.write(usermode)
preferenceusermodefile.close()
def finishSetup():
username = choiceusername.get()
if username == "":
app.withdraw()
ctypes.windll.user32.MessageBoxW(0, "You must choose a correct username !", "BeevePlayer - Error", 0)
app.deiconify()
else:
app.destroy()
usernamefile = open("src/config/username.txt", "w")
usernamefile.write(username)
usernamefile.close()
setupdonefile = open("src/config/setup.txt", "w")
setupdonefile.write("done")
setupdonefile.close()
ctypes.windll.user32.MessageBoxW(0, "Setup is now done, restart BeevePlayer to start using it.", "BeevePlayer - Setup Done", 0)
os.system("taskkill /f /im python.exe")
ctypes.windll.user32.MessageBoxW(0, "Welcome on BeevePlayer, click OK to continue.", "BeevePlayer - Welcome", 0)
app = Tk()
app.title("BeevePlayer - Setup")
app.geometry("500x400")
app.resizable(False, False)
app.iconbitmap("src/icons/icon.ico")
# icon = PhotoImage(file="src/icons/iconcircle.png")
# icon3 = icon.subsample(5, 5)
# icon2 = Label(app, image=icon3, bg="#333333")
# icon2.image = icon3
# icon2.place(relx=0.15, rely=0.12, anchor=CENTER)
tk.Label(app, text="\n\nWelcome on BeevePlayer !", fg="white", bg="#333333", font=("Segoe UI", 15, "bold")).pack()
tk.Label(app, text="\nTo continue, choose an username to use BeevePlayer:\n", fg="white", bg="#333333", font=("Segoe UI", 10)).pack()
choiceusername = Entry(app, text="username")
choiceusername.pack()
tk.Label(app, text="\n", bg="#333333").pack()
tk.Label(app, text="Do you want to use Dark Mode\nor White Mode ? (Optional):\n", fg="white", bg="#333333", font=("Segoe UI", 10, "bold")).pack()
darkorwhitemodeVar = StringVar(app)
darkorwhitemodeVar.set(f"Dark/White Mode")
modes = ("Dark", "White")
choicemode = OptionMenu(app, darkorwhitemodeVar, modes[1], *modes, command=preferenceusermode)
choicemode.pack()
tk.Label(app, text="\n", bg="#333333").pack()
Button(app, text="Continue", command=finishSetup).pack()
app.config(bg="#333333")
app.mainloop()
else:
pass
checksetupdone()
app = Tk()
app.title("BeevePlayer")
app.geometry("800x500")
app.resizable(False, False)
app.iconbitmap("src/icons/icon.ico")
def credits():
ctypes.windll.user32.MessageBoxW(0, "made by: miyucode and Beeve / actual version: 1.0", "BeevePlayer - Credits", 0)
def stopMusic():
pygame.mixer.music.stop()
songname.pack_forget()
app.title("BeevePlayer")
stopmusicbutton2.place_forget()
choosemusicbutton2.place(relx=0.50, rely=0.15, anchor=CENTER)
pausemusicbutton2.place_forget()
resumemusicbutton2.place_forget()
# songphoto1.place_forget()
def resumeMusic():
pygame.mixer.music.unpause()
resumemusicbutton2.place_forget()
pausemusicbutton2.place(relx=0.35, rely=0.25, anchor=CENTER)
def pauseMusic():
pygame.mixer.music.pause()
pausemusicbutton2.place_forget()
resumemusicbutton2.place(relx=0.65, rely=0.25, anchor=CENTER)
def startMusic():
global photo
username = getpass.getuser()
file = fd.askopenfilename(title='Choose a music (.mp3, .waw)', filetypes=[('MP3', '*.mp3*'), ("WAW", "*.waw*")], initialdir=f"C:/Users/{username}/Desktop")
if file == "":
pass
else:
# songphoto = PhotoImage(file=file)
# songphoto1.config(image=songphoto)
# songphoto1.place(relx=0.50, rely=0.35)
pygame.mixer.init()
choosemusicbutton2.place_forget()
songname.pack()
songname.config(text=f"\nCurrent song:\n{file}\n")
app.title(f"BeevePlayer - Current song: {file}")
pygame.mixer.music.load(file)
pygame.mixer.music.play()
stopmusicbutton2.place(relx=0.50, rely=0.25, anchor=CENTER)
pausemusicbutton2.place(relx=0.35, rely=0.25, anchor=CENTER)
navbar = Menu(app)
navbarmenu = Menu(navbar, tearoff=0)
navbarmenu.add_command(label="Credits", command=credits)
navbar.add_cascade(label="Settings", menu=navbarmenu)
choosemusicbutton = PhotoImage(file="src/icons/choosemusicbutton.png")
choosemusicbutton3 = choosemusicbutton.subsample(4, 4)
choosemusicbutton2 = Button(app, image=choosemusicbutton3, command=startMusic)
choosemusicbutton2.image = choosemusicbutton3
choosemusicbutton2.place(relx=0.50, rely=0.15, anchor=CENTER)
songname = tk.Label(app, text="\n", fg="white", bg="#333333", font=("Segoe UI", 10, "bold"))
songname.pack_forget()
stopmusicbutton = PhotoImage(file="src/icons/stopicon.png")
stopmusicbutton3 = stopmusicbutton.subsample(7, 7)
stopmusicbutton2 = Button(app, image=stopmusicbutton3, command=stopMusic)
stopmusicbutton2.image = stopmusicbutton3
stopmusicbutton2.place(relx=0.50, rely=0.25, anchor=CENTER)
stopmusicbutton2.place_forget()
pausemusicbutton = PhotoImage(file="src/icons/pauseicon.png")
pausemusicbutton3 = pausemusicbutton.subsample(7, 7)
pausemusicbutton2 = Button(app, image=pausemusicbutton3, command=pauseMusic)
pausemusicbutton2.image = pausemusicbutton3
pausemusicbutton2.place(relx=0.35, rely=0.25, anchor=CENTER)
pausemusicbutton2.place_forget()
resumemusicbutton = PhotoImage(file="src/icons/resumeicon.png")
resumemusicbutton3 = resumemusicbutton.subsample(7, 7)
resumemusicbutton2 = Button(app, image=resumemusicbutton3, command=resumeMusic)
resumemusicbutton2.image = resumemusicbutton3
resumemusicbutton2.place(relx=0.65, rely=0.25, anchor=CENTER)
resumemusicbutton2.place_forget()
# photo = ""
# songphoto1 = tk.Label(app)
# songphoto1.place(relx=0.50, rely=0.35)
# songphoto1.place_forget()
app.config(bg="#333333", menu=navbar)
app.mainloop()