<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<font size="4">Please pardon what may be a dumb question from a
self- (half-) taught student of Python. I often steal fragments
of code from the internet (especially including this forum) and
sometimes get an error message like "xxx is not an attribute of
yyy" . My problem, I think, is a missing " from xyz import
abc". My question to you now is whether there is some way to know
what to import, and from which module, for any particular Python
statement. More specifically, I get this error message:<br>
<br>
AttributeError: 'QgsEditFormConfig' object has no attribute
'setHidden'<br>
<br>
when I run the following code:<br>
<br>
from qgis.core import QgsProject<br>
from qgis.core import *<br>
from qgis.utils import iface<br>
from qgis.core import * <br>
from PyQt5.QtWidgets import QInputDialog<br>
from PyQt5.QtWidgets import *<br>
from qgis.PyQt.QtCore import * <br>
from qgis.gui import * <br>
<br>
def oneA( lyr, columnName, option ): <br>
flds= lyr.fields()<br>
indx = flds.indexOf(columnName)<br>
config = lyr.editFormConfig()<br>
config.setHidden(indx, option)<br>
lyr.setEditFormConfig(config)<br>
<br>
lyr = iface.activeLayer()<br>
aField = 'NAME' <br>
oneA (lyr, aField, True)<br>
<br>
When I type this code in the QGIS environment, autocompletion
leads me to believe that "setHidden" is allowed after "config."
but I must admit I don't understand the meaning of the several
choices specified in the parentheses. I'd be grateful if someone
would explain that to me. Also, am I correct in thinking that an
asterisk following "import" means "everything in this module"?<br>
I'm running QGIS 3.16.3 under Windows 10.<br>
Thanks in advance for any help.<br>
<br>
</font>
</body>
</html>