Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,600 members, 7,812,958 topics. Date: Monday, 29 April 2024 at 11:48 PM

Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland - Programming (2) - Nairaland

Nairaland Forum / Science/Technology / Programming / Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland (16394 Views)

Transform Your Web Project In HTML And Php/mysql To A Desktop Software In .exe / How To Make a DESKTOP Executable Software Using PHP,MYSQL,SQLITE / How To Make Money From Developing Software Using Vb Or Java (2) (3) (4)

(1) (2) (3) (Reply) (Go Down)

Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by Nobody: 3:49pm On Nov 29, 2014
Nice Thread OP.. I really commend your efforts..
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by xmarcel: 4:54pm On Nov 29, 2014
WxPython is nice, but I prefer PyQt... guess I'm just being biased cheesy
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by umaryusuf(m): 7:30pm On Nov 29, 2014
@all, thank for ur kind words.



xmarcel:
WxPython is nice, but I prefer PyQt... guess I'm just being biased cheesy

Ur opinion is on d right path! Especially if u are looking beyond PC desktop apps.
At the moment wxPy is left behind.... when it comes to deploying apps on Android/iOS mobile devices.
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by umaryusuf(m): 5:14pm On Nov 30, 2014
[size=20pt]COMPILING, PACKAGING AND DISTRIBUTING OUR COMPLETED APP[/size]
Am glad you read this far, we are almost there!
For sure, we can zip the “gui.py” file and distribute it by emails or other means. But the problem with this is that only users with Python and wxPython lib installed on their PC can run the application (so we have a BIG drawback here).

The primary aim of today's class is to take our application to the next level by making it possible for every computer system to run it with or without Python installed on it. To achieve this, we make use of two programs we have installed earlier (i.e. Py2exe and Inno Setup Compiler).

~~ First we use the "Py2exe" python library to create an executable for our application, then we use "Inno Setup Compiler" to create an installer for our app.

~~ Now create a blank file name “setup.py” and type this code below in it and save.
from distutils.core import setup
import py2exe

setup(windows=['gui.py'])
~~ Run the following on the command prompt to create an executable for our app.
python setup.py py2exe
This will run and generate to folders named “build” and “dist” in our project folder. Open the “dist” folder, the app executable will be seen there and the “build” folder is no longer essential. See image-27 below.

~~ Contents of your “dist” folder should look like mine below (image-28); the executable file is shown with arrow (that is: gui.exe).
Double clicking the executable file (gui.exe) should open up the Expression Evaluator Application, BOOM!

~~ Now we can rename the “dist” folder to the name of our app (Expression Evaluator) and zip it for distribution. Any windows PC would be able to run our Expression Evaluator application with or without Python/wxPython library installed on the computer.

To add more professionalism to our program, we will compile it into an installer using the Inno Setup Compiler.

~~ Launch the Inno Setup Compiler and chose “create a new script file using wizard” and click “Ok”. See image-29.

~~ On the next couple of screens press “Next” and fill the appropriate details.

~~ On the “Application file” page, click “Browse” then navigate to the “dist” folder and select the executable file (gui.exe). See image-30

~~ Click on “Add files” button to add all the files within the “dist” folder. See image-31

~~ On the next window chose option that suite your needs. I will accept default options and go to next page “Application documentation” then select your setup language(s).

~~ On the “Compiler settings” window, you can select an icon for the installer setup file and you can also set password for the installer.
Select “Yes” when you see the screen (See image-32) below to compile instantly.

~~ Save your script and inno setup compiler does its thing... This script can be edited using Pascal programming language. See image-33

~~ When it finishes, go to the folder you selected for the setup output to see the installer created by inno setup compiler placed in a folder named “output”. See image-34

~~ This setup can now be distributed for installation on window PCs that doesn’t have python installed.
Our application is now more professional. We can run the installer to install the Expression evaluator program on any computer system.

~~ After installing it, check the windows start panel, or desktop (if you enabled this option) to see your installed app as show below (image-35). An icon to the software will also be available in the system’s control panel for un-installation. See image-36.

This mark the end to this tutorial, hope you enjoyed reading it?
Be free to share and ask questions

Happy wxPython GUI coding

1 Like

Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by umaryusuf(m): 5:13pm On Dec 01, 2014
[size=20pt]Conclusion[/size]

Over the past few days, you have learned how to create a simple but useful application with wxPython.

We’ve now created a useful application with limited knowledge of wxPython. The simplicity of it all proves how easy it is to create graphical user interfaces in Python applications by using the wxPython library. In fact, the most complicated thing we did in the whole application was create a system that would allow us to easily perform operations and make our calculator work.

There’s still a lot more to wxPython.

Happy wxPython GUI coding

1 Like

Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by Nobody: 4:09am On Dec 02, 2014
Hello ,good people
Pls I would seriously want to learn python. Besides the materials provided by OP, does anyone know of someone in Lagos or a where I can be trained on python?
Thanks
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by kemetic7(m): 6:30pm On Dec 03, 2014
umaryusuf:
[size=20pt]Conclusion[/size]

Over the past few days, you have learned how to create a simple but useful application with wxPython.

We’ve now created a useful application with limited knowledge of wxPython. The simplicity of it all proves how easy it is to create graphical user interfaces in Python applications by using the wxPython library. In fact, the most complicated thing we did in the whole application was create a system that would allow us to easily perform operations and make our calculator work.

There’s still a lot more to wxPython.

Happy wxPython GUI coding

Very Very Good! You did well my brother. I hope other programmers like you will showcase his/her knowledge like this. May God bless you.
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by umaryusuf(m): 10:06am On Dec 04, 2014
tattystv:
Hello ,good people
Pls I would seriously want to learn python. Besides the materials provided by OP, does anyone know of someone in Lagos or a where I can be trained on python?
Thanks
Hope u hv gotten a contact at Lagos?
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by umaryusuf(m): 10:08am On Dec 04, 2014
@kemetic7, thanks for or kind words.
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by Nobody: 10:06am On Dec 05, 2014
umaryusuf:

Hope u hv gotten a contact at Lagos?

not yet bro, still looking for one.

thanks
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by xmarcel: 11:24am On Dec 05, 2014
tattystv:


not yet bro, still looking for one.

thanks
Where in Lagos do you stay? I stay in Lagos, but currently not there, off to school, I'm learning python too
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by pricelessmr: 11:47pm On Dec 05, 2014
umaryusuf:
[size=20pt]Conclusion[/size]

Over the past few days, you have learned how to create a simple but useful application with wxPython.

We’ve now created a useful application with limited knowledge of wxPython. The simplicity of it all proves how easy it is to create graphical user interfaces in Python applications by using the wxPython library. In fact, the most complicated thing we did in the whole application was create a system that would allow us to easily perform operations and make our calculator work.

There’s still a lot more to wxPython.

Happy wxPython GUI coding

Thanks a lot
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by umaryusuf(m): 6:03pm On Dec 06, 2014
pricelessmr:


Thanks a lot


You are most welcomed bro.
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by umaryusuf(m): 8:19am On Dec 13, 2014
Attached are the python files containing codes generated through the tutorial. That is:-
1) eval.py = the console version of the Expression Evaluator
2) frame.py = our first frame/window in wxpython
3) gui.py = the GUI code
4) setup.py = the code that creates .exe file

2 Likes

Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by Barywhyte(m): 12:40am On Dec 15, 2014
umaryusuf:
Attached are the python files containing codes generated through the tutorial. That is:-
1) eval.py = the console version of the Expression Evaluator
2) frame.py = our first frame/window in wxpython
3) gui.py = the GUI code
4) setup.py = the code that creates .exe file


Thank you OP. You did well. I just followed the thread but unable to read thru since I started following. kind of busy lol. I work on Linux: ubuntu and fedora and I am learning python to compliment skills I have in Bash programming. I don't use windows for anything, sorry. There seem to be no GUI app for Linux that can do this drag and drop method of gui coding as you did it above. Are you aware of any? Could you please give me some assignment to work on? Kind of live project to test my level of skills in python. Plz don't bother to ask about my skill level ok. Just give me something to work and I will try to submit it back to you within a time frame specified by you. Don't worry about my own schedule too lol. You don't have to do this but I will appreciate it, as I hope to learn under you. Thank you bro.

your partner in coding
whyte
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by 7thHaybee: 10:24am On Dec 15, 2014
Hi. Thanks a lot for the thread....m aving a prob wit d source code oo..when I run it, it only flashes a doslike window and dats it . d py interpreter and d rest re correctly installed. m thinking d prob is from d 1st line (exactly urs) cos wen I remove it it dos d same thing.OP and oda gurus pls help.
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by umaryusuf(m): 12:49pm On Dec 15, 2014
Barywhyte:



Thank you OP. You did well. I just followed the thread but unable to read thru since I started following. kind of busy lol. I work on Linux: ubuntu and fedora and I am learning python to compliment skills I have in Bash programming. I don't use windows for anything, sorry. There seem to be no GUI app for Linux that can do this drag and drop method of gui coding as you did it above. Are you aware of any? Could you please give me some assignment to work on? Kind of live project to test my level of skills in python. Plz don't bother to ask about my skill level ok. Just give me something to work and I will try to submit it back to you within a time frame specified by you. Don't worry about my own schedule too lol. You don't have to do this but I will appreciate it, as I hope to learn under you. Thank you bro.

your partner in coding
whyte


No much python gui RAD for Linux, but Qt Designer has a Linux version for PyQt/PySide.

As for assignment, develop on what we learned here to create/add more widgets (buttons), and menu to the app as seen on attached image. You can complete this within 48hrs

Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by umaryusuf(m): 1:06pm On Dec 15, 2014
7thHaybee:
Hi. Thanks a lot for the thread....m aving a prob wit d source code oo..when I run it, it only flashes a doslike window and dats it . d py interpreter and d rest re correctly installed. m thinking d prob is from d 1st line (exactly urs) cos wen I remove it it dos d same thing.OP and oda gurus pls help.

What is the error message and the name of the file?
Try run it in dos directly (that is: python filename.py), so u can see the error message, instead of launching/running the file directly.
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by 7thHaybee: 4:40pm On Dec 15, 2014
umaryusuf:


What is the error message and the name of the file?
Try run it in dos directly (that is: python filename.py), so u can see the error message, instead of launching/running the file directly.
now its eval.py ....still d same error code : no such file

Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by umaryusuf(m): 5:09pm On Dec 15, 2014
7thHaybee:

now its eval.py ....still d same error code : no such file

Yes, is because ur cmd/dos is not pointing to the folder where u have the eval.py file was saved.

To do that, open the folder where u saved the eval.py and hold/press “Shift” button on your keyboard then right-click inside the folder on empty space then select "open command window here".

Now open the file by entering: python eval.py

The file should run accordingly.



Note: you can also use the usual DOS commands to navigate your way into the folder. The above explanation is shortcut approach.
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by 7thHaybee: 7:07pm On Dec 15, 2014
sad ....m sure am doing somtin wrong ....ur own code runs fine ....only when I type it out ...it does that.Opening command prompt in d folder gave me some line 8 error...pls check ..thanks a lot.

Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by umaryusuf(m): 7:49pm On Dec 15, 2014
7thHaybee:
sad ....m sure am doing somtin wrong ....ur own code runs fine ....only when I type it out ...it does that.Opening command prompt in d folder gave me some line 8 error...pls check ..thanks a lot.

For sure, the error u are getting is call "IndentationError".
Be sure you maintain uniform indentation throughout ur code. The standard practice is the use of 4spaces.
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by 7thHaybee: 10:59pm On Dec 15, 2014
umaryusuf:


For sure, the error u are getting is call "IndentationError".
Be sure you maintain uniform indentation throughout ur code. The standard practice is the use of 4spaces.
yes !...finally gt it (opens on its own nw) …thanks a lot
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by umaryusuf(m): 11:07am On Dec 17, 2014
^^ glad u found a solution.
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by umaryusuf(m): 11:08am On Dec 17, 2014
^^ glad u found a solution.

The cause of d error could also come from ur text editor. But generally indentation errors are very easy to handle in py.
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by Barywhyte(m): 6:12pm On Dec 19, 2014
umaryusuf:



No much python gui RAD for Linux, but Qt Designer has a Linux version for PyQt/PySide.

As for assignment, develop on what we learned here to create/add more widgets (buttons), and menu to the app as seen on attached image. You can complete this within 48hrs

Yes Op tnk u. just getting in nl now. I will work on this OK and get back to u. tanks. do u already use pop or just functional programming?
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by umaryusuf(m): 5:01pm On Dec 20, 2014
Barywhyte:


Yes Op tnk u. just getting in nl now. I will work on this OK and get back to u. tanks. do u already use pop or just functional programming?


You are welcomed!
Yes, if you mean OOP and NO, if you mean pop.
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by umaryusuf(m): 6:04pm On Apr 28, 2015
This tutorial is available for download in PDF format: http://umaryusuf.com/wxpy/wxPython-gui-tutorial.pdf


Desktop GUI app development using python programming language.
Learn quickly creating a professional looking desktop application/software using Python/wxpython, wxformBuilder, Py2exe and Innosetup
This tutorial is available for download in PDF format: http://umaryusuf.com/wxpy/wxPython-gui-tutorial.pdf

1 Like

Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by Barywhyte(m): 11:13pm On May 04, 2015
umaryusuf:
This tutorial is available for download in PDF format: http://umaryusuf.com/wxpy/wxPython-gui-tutorial.pdf

Great job Umar! Your pdf presentation is wholesome! Didnt know before now how powerful eval() really is.
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by umaryusuf(m): 3:20pm On May 11, 2015
^^ u are most welcomed. In fact the eval() function is one of Python's hidden treasures! grin
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by Barywhyte(m): 9:30pm On May 11, 2015
umaryusuf:
^^ u are most welcomed. In fact the eval() function is one of Python's hidden treasures! grin

the simplest way to build a calculator
Re: Learn How To Build A Desktop Software Using PYTHON – Tutorial On Nairaland by lukman008: 6:23am On Aug 17, 2015
Ur opinion is on d right path! Especially if u are looking beyond PC desktop apps.
At the moment wxPy is left behind.... when it comes to deploying apps on Android/iOS mobile devices.[/quote]

Please how can I convert py to apk

(1) (2) (3) (Reply)

What Language Do I Need To Learn For Software Development? / Funny Source Code Comments / Is C# Better Than C/C++?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 53
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.