Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
app-pyaudioplayer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
santiago duque
app-pyaudioplayer
Commits
a15ff8fb
Commit
a15ff8fb
authored
Jan 14, 2025
by
santiago duque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added second button and logic to stop events as a test
parent
3b289386
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
main.py
main.py
+17
-5
No files found.
main.py
View file @
a15ff8fb
...
...
@@ -17,11 +17,8 @@ window = pygame.display.set_mode((winW, winH))
# window.fill((205,100,100))
# pygame.display.update()
#
clock = pygame.time.Clock()
clock
=
pygame
.
time
.
Clock
()
btn1
=
Button
(
21
)
btn1
.
when_pressed
=
lambda
:
play_sound
(
0
)
def
reset_sounds
():
global
sound_array
...
...
@@ -56,6 +53,9 @@ def play_sound(index):
global
current_sound_index
global
channel
global
sound_array
global
btn_array
btn_array
[
index
]
.
when_pressed
=
None
if
not
cut_current_sound
:
current_sound_index
=
index
...
...
@@ -117,9 +117,21 @@ current_sound_index = -1
# run setup
setup_paths
(
False
)
btn1
=
Button
(
21
)
btn1
.
when_pressed
=
lambda
:
play_sound
(
0
)
btn1
.
when_released
=
lambda
:
btn1
.
when_pressed
=
lambda
:
play_sound
(
0
)
btn2
=
Button
(
13
)
btn2
.
when_pressed
=
lambda
:
play_sound
(
1
)
btn2
.
when_released
=
lambda
:
btn2
.
when_pressed
=
lambda
:
play_sound
(
1
)
btn_array
=
[
btn1
,
btn2
]
run
=
True
while
run
:
# clock.tick(30
)
clock
.
tick
(
25
)
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
pygame
.
QUIT
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment