Problem with InstallForge and CustomTkinter - python

I am currently working on a gui with the custom tkinter lib.
I created the .exe file by adding the CustomTkinter with auto-py-to-exe
Then I use the InstallForge software because I want to share my file.
After that I got my setup file, it works on my computer but not on my friends one.
Do you guys now why ?
I try to use other software like Inno Setup compiler but the problem is still the same, the application cant be launched.
I run is as admin : result : the application cant be launched.
Here is the files that I add in the software Install Forge
Thank you.

Related

Application created with pynsist will not execute script

I am trying to create a very simple desktop application with one python module in pynsist. Pynsist appears to be functioning correctly, and the application installs correctly. When I try to launch the application from the start menu, it appears to open briefly, but does not execute the script. To test if it was something wrong with my code, or config file, I created a very dumbed down version and am having the same issue. My config file is as follows:
[Application]
name=Please work
version=1.0
entry_point=Test:main
publisher:Company ABC
[Python]
version=3.6.4
bitness=32
[Include]
packages=Test
tkinter
_tkinter
My module "Test.py" is saved in the same folder as the config file and is as follows:
from tkinter import messagebox
def main():
messagebox.showinfo("New Box","Why don't I work?")
main()
This seems like it should be an easy fix, but am I missing something? In going through the message boards, some people appeared to have issues with tkinter; however, I was not getting any errors when pynsist created the application (as other people were getting)
Help is greatly appreciated.
EDIT: upon further investigation, it appears that tkinter though included in the application is not accessible to the installed python version that pynsist includes.

pywin installed, but PythonWin cannot open

I installed pywin from this site. I used version pywin32-220.win-amd64-py3.6.exe, and it installed without any error.
I am trying to automate use of a software. To do this, I am following a tutorial that says I need to select something from the Tools Menu in pywin. So I expected to find a program with a GUI that I could open from the Windows Start Menu.
However, although I see pywin in Control Panel's Add or Remove Programs, it is not in the start menu, and I don't know where to find it or how to open.
If my description is too vague to suggest a solution, a useful answer to my query would be diagnostic questions I should be asking.
Thank you.
Additional information:
- I am using windows 10.
PythonWin is what I want, yes. It is not in the start menu. (I understand now that pywin32 would not show in the start menu.)
There is a pywin folder on my desktop. One of the subfolders is called Pythonwin. Inside that folder, there is no .exe file. There is a file called start_pythonwin.pyw, but clicking it does not open anything. Based on this webpage, PythonWin needs to be installed separately. Perhaps that is my situation. But there is no .exe file in this folder. I do not know how to install a program from a folder of files--if that is what I need to do, please provide a reference.
Before I can automate use of the softare, the tutorial mentioned above provides the following instructions (sorry, it's on the software site and you have to login, so I can't link). I need to open the GUI to do step 1, but I can't open it.
Instructions:
Open PythonWin and start the COM Makepy utility from the Tools menu. Locate DesktopController Library in the list of COM interfaces and click OK. This produces the following result.
">>> Generating to C:\Python25\lib\site-packages\win32com\gen_py\62401B69-06B2-4C4F-992E-B7A57EFBF059x0x1x0.py
Building definitions from type library...
Generating...
Importing module
Press return and then import the COM support module by typing...(at this point, the tutorial explains how to write code to automate the software...)
I need to select something from the Tools Menu in pywin
I think you mean PythonWin (it comes with pywin32 installer). PythonWin comes with a few tools to use with Pywin32 (it's a GUI program, a Python editor actually and it has a Tools menu). Check your tutorial again and make sure what it is that you're looking for. I could have checked it out, but you didn't provide a link or a quote so it's hard to help you.
Anyway, if it is PythonWin what you are looking for (and I think it is), it should be located along side Python in your start menu.
Hope this helps.
Ok, now that you have updated your question I can help a bit more.
I don't understand how the installer didn't install PythonWin on your Python Start Menu but ok. Since what you want to do is execute makepy, there is another way to do it besides the PythonWin program.
Go to your site-packages folder, then win32com and then into the client directory. So the path will be something like C:\Python36\Lib\site-packages\win32com\client\. There you will find a file called makepy.py and another called makepy.pyc. Either one of those can be used to launch the makepy tool.
Once you have used the makepy tool to create the wrapper to your COM object you can find it in the gen_py directory.
You can comment to this answer if you have any questions.

Writing shell extensions in Python and compiling

I am trying to create a shell extension context menu and icon overlay. I have successfully registered and seen a context menu show up when right clicking and the menu clicks are correctly responding to the code when running the program through Python.
My issue is when I try to compile the Python code to an executable with cx_Freeze or py2exe. It builds the executable and running the executable creates a registry entry, but no menu shows up when right clicking after restarting explorer.exe.
I thought cx_Freeze or py2exe would be able to register the context menu or overlay and have it talk to the code within the exe. Do I need to make a dll file? I am not very familiar with com servers so anyone who has experience with shell extensions would be greatly appreciated.
I have more details if requested/needed.
I was able to get the context menu registered through a dll following the steps in this link. I ended up using py2exe for 2.7 and I am not sure if the setup they used is what fixed it or if I needed to use regsvr32 when registering the dll instead of the self registry executable. I also used a patched py2exe that is in the answer of the link
Link:
Com server build using Python on 64-bit Windows 7 machine

Create a desktop icon for a Tkinter script

I have written a python script with a Tkinter GUI. I would like to create a desktop icon that will execute this script so that the end-user (not myself) will be able to double-click the icon and have the GUI load, rather than 'run' the script from the terminal or python shell and then have to F5 from there.
Is there a way to do this? I have googled many arrangements of my question but most answers seem to be normal python scripts, not ones which are Tkinter based.
I am using a Raspberry Pi with Wheezy and Python 2.7
Thanks in advance.
I create executables(icons that I click to start the programs I write) using 'py2exe'. I use windows 7 and I am not sure if it would work for you with Raspberry Pi, but a google search may clear that up for you. I will provide the link below. Basically you end up with a folder with the executable(icon) and also some files, without which the executable won't work. It's unfortunate that you get this extra 'baggage', but it's still handy and the best solution I have come across. I don't think there is a much better way, but I am not 100% on that. Interestingly, I found that you could delete most of these baggage files and the executable would still work, it was trial and error, but it didn't take long. If I want to send the folder to someone, I zip it first.
py2exe is here
If you need a 64 bit binary you can get it here, along with, actually, pretty much every other version. get py2exe here also
Besides creating executable file other option is create simple .bat file:
Open notepad
Enter "C:\ProgramData\Anaconda3\python.exe" "C:\Users\Your ID\script.py"
First part is path to python.exe, second to your python script
save file as .bat file, ex. "open_program.bat"
Now simply double click on saved .bat file icon should open your script.
I like using cx-freeze to convert python scripts to exe.
There is very easy to follow documentation to do this. In short, you create a setup.py script that specifies what libraries and packages you want to include or exclude in your application.
You can then run the build in the console and it will create a build folder, in which will be an Application File. You can create a Desktop short cut using send to and selecting desktop.
Documentation link
You can save the script as a .pyw file so the user can click on the file and the GUi would open

Problems with Tkinter in py2exe

I made a a simple GUI program in python with tkinter and attempted to convert it to an .exe using py2exe. However, I've run into a problem. When I try to run the exe it flashes an error very quickly then disapears. So the best I could do was take a screan shot of the error.
How do I go about fixing this?
Edit
Velociraptors, this is my setup file. It's about as basic as it can be. How would I go about integrating init.tcl into the code?
from distutils.core import setup
import py2exe
setup(console=[r'C:\Python26\Random Password Generator.py'])
Does your setup.py script include init.tcl in the data_files option? The py2exe list of options says that's how you should include images and other required data files.
Edit:
Your setup script specifies that your program should be converted to a console exe. If you want a GUI program (which you do, since you're using Tkinter), you need to use the windows option:
setup(windows=[r'C:\Python26\Random Password Generator.py'])
Py2exe should correctly include Tkinter's dependencies. If not, you can manually include init.tcl:
setup(data_files=['C:\Python26\tcl\tcl8.5\init.tcl'],
windows=[r'C:\Python26\Random Password Generator.py'])
Ensure that tcl is installed in C:\Users\splotchy\lib\tcl8.5 or C:\Users\lib\tcl8.5.
If you want to see the error messages for longer, run your program from a command prompt.
I found a bug on the virutalenv site which suggested the following https://github.com/pypa/virtualenv/issues/93
for windows in your directory "C:\Environments\VirtualEnv\Scripts\activate.bat" just add which are set to the right path to TCL and TK for your python version
set "TCL_LIBRARY=C:\Python27\tcl\tcl8.5"
set "TK_LIBRARY=C:\Python27\tcl\tk8.5"
restart your cmd or shell
I believe that the TCL location have changed from there default ones.

Categories