Issue
I'm building a program in PyQt where a user can choose from a set of selectable menu items. However, I want the user to only be able to click on things when certain conditions have been met. What I would like to know is, is it possible to gray out or completely disable an item in the menu area?
Solution
It is possible to do something like this.
use setDisabled
to do this.
Here is an example of this working.
The parameter is a boolean, and setting it to True will make your object grey out.
self.FooBarMenuItem.setDisabled(True)
to turn it off, simply set the parameter's value to False
self.FooBarMenuItem.setDisabled(False)
You can also make items completely disappear by using the setVisible function
self.FooBarMenuItem.setVisible(False)
Answered By - tisaconundrum
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.