Graphics Reference
In-Depth Information
dialog = MyDialog()
if dialog.exec_() == QDialog.Accepted:
lat = dialog.lat_field.text()
long = dialog.long_field.text()
print lat,long
Running this script will cause the following dialog box to be displayed:
If the user clicks on the OK button, the entered latitude and longitude values will be prin-
ted to the console. Of course, this is just a simple example—there's no error checking or
conversion of the entered values from text back to numbers. However, this is just a simple
example. There's a lot more that can be done using the PyQt libraries, and people have
written entire topics on the subject. However, the main thing to realize now is that, be-
cause QGIS is built on top of Qt, you can use all of the features of PyQt to build sophistic-
ated user interfaces. You're certainly not limited to using the Python console to interact
with the user.
Search WWH ::




Custom Search