![]() |
SOLVED - Help pyQT buttons pressed and loop sound
hi guys i want to make a button pressed when clicked. Can you post me some exaples? I explain.. Button has to be clickable, has to play a sound and has to be of a different color when pressed. Buttons have some icons inside, and when one is pressed, has to repeat the sound until you 'll close the app can you help me to create this in PyQT ?
|
Re: Help pyQT buttons pressed
Quote:
Just as a FYI, there is a Development section on the forum here. A lot of developers monitor the subforum so it's a good place to ask these kinds of questions in future, it will help your post get seen by the right people and get more replies :) |
Re: Help pyQT buttons pressed
Quote:
|
Re: Help pyQT buttons pressed
Quote:
Let me know if you have any problems working things out :) it should be pretty straight forward depending on your coding experience. I have code to make phonon sound files loop at home (part of the original PyQt mFakeCaller project code I used to repeat the ringtone soundfile) - I can paste in if you need it. To stop the sound playing when the app closes you could create a call to stop it in the application's deconstructor. im interested though, what kind of application are you creating that it keeps playing a sound until the app is closed? :) |
Re: Help pyQT buttons pressed
but to make a loop of a sound ? your app is very funny :D ahahhaha i'm creating a mosquito hunter :D to leave away mosquitos :D i have 2 buttons with twoo icons inside one to leave away mosquitos normally, the other to disturb mosquitos hardly
when closed it has to stop the sound ;) sounds worked very well yesterday :D |
Re: Help pyQT buttons pressed
Quote:
Well the phonon sound player will give off a 'finished()' signal when it has completed playing. So using Qt's signals and slots methodology, one way to get it to loop is to connect the finished signal of the sound file playing to a slot that starts playing the sound file. And voila.. a looping sound :) have a try and see if you can get it to work ;) |
Re: Help pyQT buttons pressed
1 Attachment(s)
Quote:
i'm very newbie in QT i gotta study better but i have not too much time, i used maeFarm code yet, i just have to change some values ;) green icon plays the Easy disturbing sound blue icon plays the hardly disturbing sound |
Re: Help pyQT buttons pressed
Those are some mean looking mosquitoes! The green one reminds me of Zorack from Space Ghost
http://www.oocities.org/goddamn_gree...otes/zorak.jpg Oh, you're using the maeFarm code lol! I always meant to do something with that and never did have the time... I should think of something. Let us know how you get on with the sound looping :) |
Re: Help pyQT buttons pressed
1 Attachment(s)
Quote:
do u like to help me ? i have a problem by the way in ubuntu i can use Qt ui, in maemo it doesnt work :( in the wait .. i changed some icons :D in ubuntu buttons stay pressed, in maemo they don't.. I have new ideas about this kind of apps :D i'll let u know bout the others first i want to complete this one. I'll apreciate your help becouse mine is just the concept and i changed just some paths, some icons and some sounds. I used MaeFarm code becouse i'm not expert in QT and unfortunatelly there's not a Italian FAQ (my en is too bad and for some reasons i need a right translation becouse its a complicated for me understanding ) in QT designer the ui uses right params about the buttons (when i click one, the other is unpressed and vice e versa..) no way on maemo :( i need a miracle |
Re: Help pyQT buttons pressed
Quote:
There would be 2 Boolean values for holding the pressed state of the two buttons - true = pressed, false = not pressed - and both set to false when the app loads (as user hasn't made a selection yet, unless u want a default). So imagine we have: Code:
ClassicMosquitoPressed = falseCode:
if button pressed = ClassicMosquitoButton{Something like that should work. It's in psuedocode as Ive moved on to QML and almost completely forgotten my Qt widgets, signal and slots, etc. :o Let me know if you try it properly in PyQt and it doesnt work for you, i'll knock up something proper and test it at home :) |
| All times are GMT. The time now is 19:39. |
vBulletin® Version 3.8.8