Hi,
On Thu, 16 May 2013 14:08:10 +1200
Greg Ewing <[email protected]> wrote:
> No, music.play() is not supposed to block. However, I haven't tried to
> use it outside the context of a pygame app, so I don't know how it
> behaves if there isn't a pygame event loop running.
Ok, now I got curious and gave it a try and programmed the simplest
TkinterMediaPlayer(TM) (see below :), works like a charm here, so it seems
like the OP's problem lies somewhere else.
Quaki, maybe you could provide us a simple code snippet that shows your
problem?
Regards
Michael
##############################################################
from Tkinter import *
import pygame.mixer as mix
from tkFileDialog import askopenfilename
from tkMessageBox import showerror
mix.init()
filename = None
def browse():
global filename
f = askopenfilename()
if f:
filename = f
def play():
mix.music.stop()
if filename:
try:
mix.music.load(filename)
mix.music.play()
except:
showerror(message='Something went wrong :(')
else:
showerror(message='No file selected')
def stop():
mix.music.stop()
root = Tk()
Button(root, text='Play', command=play).pack(
side='left', padx=20, pady=50)
Button(root, text='Stop', command=stop).pack(
side='left', padx=20, pady=50)
Button(root, text='Browse...', command=browse).pack(
side='left', padx=20, pady=50)
root.mainloop()
###############################################################
.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
Virtue is a relative term.
-- Spock, "Friday's Child", stardate 3499.1
_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss