[PyQt] Accessing a toggle button without clicking on it

Phil phil_lor at bigpond.com
Wed Jul 10 01:37:50 BST 2013


On 09/07/13 17:03, Giuseppe Corbelli wrote:
> On 07/07/2013 11:51, Phil wrote:
>> Thank you for reading this.
>>
>> How to I access my toggle button slot without clicking on the button?
>> For example:
>>
>> if hr == 19:
>> # this button is accessible
>> self. on_pushButton_clicked()
>>
>> # this fails because checked is not defined
>> self.on_ledButton_toggled(checked)
>
> self.pushButton.click() should do.

Thanks Giuesppe, I appreciate your reply.

This is how I overcame the problem a couple of hours after I posted my 
question:

self.ledButton.setChecked(True)

ledButton is a toggle button.

-- 
Regards,
Phil


More information about the PyQt mailing list