|
|
2011-05-16
, 12:57
|
|
Posts: 1,086 |
Thanked: 2,964 times |
Joined on Jan 2010
|
#2
|
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 ?
|
|
2011-05-16
, 13:01
|
|
|
Posts: 518 |
Thanked: 334 times |
Joined on Mar 2010
@ italy
|
#3
|
Hi santiago, check out my 'fart app in 30 mins' tutorial - link in my signature - it sounds like it could help you. It's a tutorial in PyQt on how to create buttons that when clicked play a sound file. So it should get you most of the way there. Changing the color is a matter of the stylesheet. You'll see where I set the button to a red colour, similarly in the same place you can set the button's color for when it is clicked.
thxxxx god bless uuu!!!
| The Following User Says Thank You to santiago For This Useful Post: | ||
|
|
2011-05-16
, 13:12
|
|
Posts: 1,086 |
Thanked: 2,964 times |
Joined on Jan 2010
|
#4
|

it should be pretty straight forward depending on your coding experience.
|
|
2011-05-16
, 13:14
|
|
|
Posts: 518 |
Thanked: 334 times |
Joined on Mar 2010
@ italy
|
#5
|
ahahhaha i'm creating a mosquito hunter
to leave away mosquitos
i have 2 buttons with twoo icons inside one to leave away mosquitos normally, the other to disturb mosquitos hardly
| The Following User Says Thank You to santiago For This Useful Post: | ||
|
|
2011-05-16
, 13:24
|
|
Posts: 1,086 |
Thanked: 2,964 times |
Joined on Jan 2010
|
#6
|
but to make a loop of a sound ? your app is very funnyahahhaha i'm creating a mosquito hunter
to leave away mosquitos
i have 2 buttons with twoo icons inside one to leave away mosquitos normally, the other to disturb mosquitos hardly
have a try and see if you can get it to work
| The Following User Says Thank You to kojacker For This Useful Post: | ||
|
|
2011-05-16
, 13:27
|
|
|
Posts: 518 |
Thanked: 334 times |
Joined on Mar 2010
@ italy
|
#7
|
lol! That sounds like madness! The N900 needs more crazy apps though, so looking forward to it!
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 soundhave a try and see if you can get it to work
i'll post u a screenshot after 

| The Following User Says Thank You to santiago For This Useful Post: | ||
|
|
2011-05-16
, 20:41
|
|
Posts: 1,086 |
Thanked: 2,964 times |
Joined on Jan 2010
|
#8
|

|
|
2011-05-17
, 12:08
|
|
|
Posts: 518 |
Thanked: 334 times |
Joined on Mar 2010
@ italy
|
#9
|
Those are some mean looking mosquitoes! The green one reminds me of Zorack from Space Ghost
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
brrrrrrrrrrrrr i'm afraid
in the wait .. i changed some icons
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 )
i need a miracle
| The Following User Says Thank You to santiago For This Useful Post: | ||
|
|
2011-05-17
, 12:48
|
|
Posts: 1,086 |
Thanked: 2,964 times |
Joined on Jan 2010
|
#10
|
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 maemoi need a miracle
When your mosquito is pushed, does the button background color change? Here's what Im thinking..ClassicMosquitoPressed = false ExtremeMosquitoPressed = false
if button pressed = ClassicMosquitoButton{
set backgroundColour of Classic Mosquito Button to the pressed colour
if (ExtremeMosquitoPressed is = true){
// means it was previously selected and we got to set it to false again now
set ExtremeMosquitoPressed to = false
set backgroundColour of Extreme Mosquito Button to the not pressed colour
}
set sound file to classic mosquito sound file
play sound
}
else{
// it must be the ExtremeMosquitoButton that has been pressed, so do all the opposite of the above :p
..
}
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
| The Following User Says Thank You to kojacker For This Useful Post: | ||
Last edited by santiago; 2011-05-19 at 05:12.