[Qgis-developer] PyQGIS App's Main Window doesnt show up
ameet chaudhari
ameet2k99 at yahoo.com
Mon Nov 15 06:47:25 EST 2010
--- On Fri, 8/10/10, Martin Dobias <wonder.sk at gmail.com> wrote:
> From: Martin Dobias <wonder.sk at gmail.com>
> Subject: Re: [Qgis-developer] PyQGIS App's Main Window doesnt show up
> To: "ameet chaudhari" <ameet2k99 at yahoo.com>
> Cc: qgis-developer at lists.osgeo.org
> Date: Friday, 8 October, 2010, 2:20 AM
> 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
Thanks Martin. That was exactly the mistake! After setting the main() method and the last two lines at top level, my application now runs :)
Many Many thanks again... this 1 almost got me to tear my hair :D
Regards
Ameet
> 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