[Qgis-developer] PyQGIS App's Main Window doesnt show up

Martin Dobias wonder.sk at gmail.com
Thu Oct 7 16:50:46 EDT 2010


Hi Ameet

in the mail it seems that some parts your file have wrong indentation
- the main() method should be top-level, not a part of the MainWindow
class. Similarly the last two lines that trigger the main() method are
supposed to be at top-level - otherwise nothing will be run.

Martin

On Tue, Sep 21, 2010 at 1:49 PM, ameet chaudhari <ameet2k99 at yahoo.com> wrote:
> [...]
>
>     def main(argv):
>         # create Qt application
>         app = QApplication(argv)
>
>         # Initialize qgis libraries
>         QgsApplication.setPrefixPath(qgis_prefix, True)
>         QgsApplication.initQgis()
>
>         # create main window
>         wnd = MainWindow()
>         # Move the app window to upper left
>         wnd.move(100,100)
>         wnd.show()
>
>         # run!
>         retval = app.exec_()
>         # exit
>         QgsApplication.exitQgis()
>         sys.exit(retval)
>
>         if __name__ == "__main__":
>             main(sys.argv)


More information about the Qgis-developer mailing list