- Joined
- 11 yrs. 6 mth. 26 days
- Messages
- 5,381
- Reaction score
- 18,380
- Age
- 45
- Wallet
- 11,590$
- [email protected]
Important links
py2exe -
Tkinter modules -
python -
After a recent request from bakie. I will be explaining how to create a graphical interface along with giving it .exe file format. Now to do this we will be using py2exe and the tkinter graphical interface. Now since I don’t have access to a standard OS at this time and am running chronos. I will be using 3rd party links, videos, and images.
First we are going to want to import the tkinter modules to create the GUI
from Tkinter import *
Now i’m just going to use a basic code to show what can be done with it. As I really don’t need to explain all the modules within Tkinter. As you can find all those from the links above.
This file name is gui.py
from Tkinter import *
frmMain = Tk()
label = Label(frmMain, text="Welcome to py2exe!")
label.pack()
frmMain.mainloop()
This is just a basic module. The output will look like.
Now if we wanted to turn this basic gui into an executable we need to setup py2exe. So download py2exe from py2exe.org after all this has been downloaded go ahead and create setup.py
The code will look like this
from distutils.core import setup
import py2exe
setup(console=['gui.py'])
To build the executable, run "python setup.py py2exe" on the command prompt. Once building process is finished you can go to where it was saved and now it will be as an .exe the benefit of doing this is the user will not have to have python installed to run it, it will just be like a regular executable file!
py2exe -
Tkinter modules -
python -
After a recent request from bakie. I will be explaining how to create a graphical interface along with giving it .exe file format. Now to do this we will be using py2exe and the tkinter graphical interface. Now since I don’t have access to a standard OS at this time and am running chronos. I will be using 3rd party links, videos, and images.
First we are going to want to import the tkinter modules to create the GUI
from Tkinter import *
Now i’m just going to use a basic code to show what can be done with it. As I really don’t need to explain all the modules within Tkinter. As you can find all those from the links above.
This file name is gui.py
from Tkinter import *
frmMain = Tk()
label = Label(frmMain, text="Welcome to py2exe!")
label.pack()
frmMain.mainloop()
This is just a basic module. The output will look like.
Now if we wanted to turn this basic gui into an executable we need to setup py2exe. So download py2exe from py2exe.org after all this has been downloaded go ahead and create setup.py
The code will look like this
from distutils.core import setup
import py2exe
setup(console=['gui.py'])
To build the executable, run "python setup.py py2exe" on the command prompt. Once building process is finished you can go to where it was saved and now it will be as an .exe the benefit of doing this is the user will not have to have python installed to run it, it will just be like a regular executable file!