Results 1 to 2 of 2

Thread: pyQT how do I enable or disable a pushbutton from the main code?

  1. #1
    Join Date
    Sep 2011
    Posts
    21
    Qt products
    Platforms
    Unix/X11 Windows

    Default pyQT how do I enable or disable a pushbutton from the main code?

    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.


    Thanks!
    Mike Sr.

  2. #2
    Join Date
    Sep 2011
    Posts
    21
    Qt products
    Platforms
    Unix/X11 Windows

    Default Re: pyQT how do I enable or disable a pushbutton from the main code?

    This code works for a range of "Button_xx"
    Qt Code:
    1. Selection=[]
    2. for i in range(16):
    3. Selection.append(getattr(tcDict.get("form"), "Button_%d" %(i+1)))
    4. Selection[i].setEnabled(False)
    To copy to clipboard, switch view to plain text mode 
    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[i].setEnabled = False will not work

    My VB6 days getting in the way...

Similar Threads

  1. How to disable pushbutton after clicking it
    By Cengaver in forum Newbie
    Replies: 12
    Last Post: 19th April 2011, 15:22
  2. Enable/Disable Zoom with a checkable action
    By yannwilfried in forum Qwt
    Replies: 2
    Last Post: 2nd December 2009, 15:30
  3. disable enable network connections?
    By remy06 in forum Qt Programming
    Replies: 2
    Last Post: 8th May 2009, 17:52
  4. Replies: 1
    Last Post: 18th December 2008, 10:25
  5. disable/enable shortcut
    By harakiri in forum Qt Programming
    Replies: 2
    Last Post: 6th May 2007, 10:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.