I have a form from which I can launch various Test Modules.

The Form has 16 PushButtons, one for each of the possible Modules.

I need to disable Button_2 through Button_11 until the Modules that are connected to Button_1 and Button_0 are succesfully completed.

The Buttons are on a pyQT mainwindow, tabbed form which is referenced by a class titled, "tcmainform".

tcmainform is in turn instansiated? as simply, "form"

Again, what I want to do is disable/enabled buttons in the main code stream.

Is there a way to do it.

I would post my code for your review but NMCI will not allow any of my development stuff on their network which is the only way I can view/post on the web while at work.

Thanks!
Mike Sr.

This code works for a range of "Button_xx"

Selection=[]
    for i in range(16):
        Selection.append(getattr(tcDict.get("form"), "Button_%d" %(i+1)))
        Selection[i].setEnabled(False)

What had me "stumped" was I forgot that the QT calls are "Functions" to which you "pass" a parameter not "set" a parameter.

that is: Selection.setEnabled = False will not work

My VB6 days getting in the way... :)

commented: Thanks for sharing. +13

Is there a way to check if the button is disabled or not? I want to enable them ..IF ..they are disabled

Perhaps the isEnabled() method ? Try pydoc PyQt4.QtGui.QPushButton.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.