Why does pyinstaller executable change the format and resolution? - python-3.x

I've been surfing through the internet and have failed to find the answers I'm looking for. I am new to python and asking questions here, but anyways, I am running windows 10, and my script uses tkinter as the GUI module. Whenever I run the script through the command prompt (or IDE) I get this: Image via IDE
Whenever I run pyinstaller executable, I get this: pyinstaller executable
As you can see, the executable changes some of the geometry of the widgets and makes the image blurry. How do I fix this on my computer, and how do I account for this across various windows supported hardware?

It turns out that the issue is with windows and can be corrected by right clicking on the executable in the file window and following these steps: https://www.ghacks.net/2020/09/14/how-to-fix-blurry-text-in-programs-on-windows-10/

Related

"Failed to execute script pyi_rth_qt4plugins" error while running exe

I have made my application using PyQt4 and it's executable using pyinstaller. The executable runs fine on my system. My system also has PyQt5 installed.
The problem is that when I try to run the same executable on the target system(client's system), it gives me an error Failed to execute script pyi_rth_qt4plugins. The client system doesn't have Python or any version of PyQt.
I wanna know why is this happening. I'm not even able to locate where is the pyi_rth_qt4plugins located in the executable. Do I need to install Python and PyQt in my client's system as well?
As per the answer from the long thread here https://github.com/pyinstaller/pyinstaller/issues/2461
In site-packages (where PyInstaller is located) edit the following file:
PyInstaller/loader/rthooks.dat
Remove this line:
'PyQt4': ['pyi_rth_qt4plugins.py'],
This error also occurs in Python3.5 if you are using 3.5 you can downgrade to 3.4 to avoid the error
check here https://github.com/pyinstaller/pyinstaller/issues/2207
or if you don't want to downgrade python you can upgrade to PyQt5

How run script Python GTK and Glade in windows?

Sorry about my English, i want to create an application with windows interface, through the website Setting up GTK for Windows I followed all MSYS2 steps to install GTK and Glade for windows. But now I can't find Glade, I can't run a python script.
About the second problem:
For me, it is sufficient to search for Glade with Windows' search function. If this is not the case for you, I have the direct executable path for you: glade.exe should be located in [..., folder where you installed msys2 to]\msys2\mingw64\bin\glade.exe.

PyInstaller executable on Windows not working because of PortAudio library issues (OSError)

I'm trying to build a .exe on Windows from my Python 3.7 application using PyInstaller. The build appears to run smoothly and shows no errors; however, executing the file on the Windows command prompt results in this awful error:
OSError: PortAudio library not found
I've done some research about this problem and found some info, but still couldn't overcome it. My app uses the sounddevice library, which depends on PortAudio library. PortAudio is installed, since the app works perfectly when I run it directly using Python; the problem is, clearly, that PyInstaller tracks the dependencies in some different way and is not able to find it and link it to the build.
This 'different way' is, actually, calling the 'find_library' function from 'ctypes.util' Python library to find the PortAudio library on the system. So, I ran the following on Python and confirmed it is not able to find the libary.
Python 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)] :: > Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
from ctypes.util import find_library
a = find_library('portaudio')
print(a)
None
So far, I've tried several solutions. First, I downloaded and compiled the last PortAudio version manually. Didn't work. Then, I tried using Anaconda instead of the official Python distribution; as you may know, Anaconda's package manager 'conda' can deal with C libraries like PortAudio. So I installed it on my Anaconda's virtual environment and tried to build my app in there. Didn't work either. I also tried adding PortAudio directory to Windows PATH variable, but it also failed. I'm kinda lost. The only idea I have yet to try is building it on Linux using Wine, but I suspect there might be a way to get it working on Windows.
Any ideas?
I managed to solve it myself. I'll post the answer, it may be useful to somebody.
What I thought was right. ctypes checks the folders defined in Windows PATH environment variable and searches them for libraries. Thing is, on Linux the system uses some kind of alias, so when
from ctypes.util import find_library
find_library('portaudio')
it returns the correct portaudio library. But on Windows, only the file names are checked. So, you have to make sure this two conditions are met:
The directory containing the PortAudio DLLs is in your PATH environment variable.
The DLL filename (without the extension) must be exactly 'portaudio'.
About the DLLs, if you were using sounddevice in your Python app, you should be able to find them here:
\your\path\to\python\Lib\site-packages_sounddevice_data\portaudio-binaries
The file is named 'libportaudio64bit.dll', so simply adding that directory to PATH won't do the trick. To overcome this, I just copied the dll into another directory, renamed it as 'portaudio.dll' and added that directory to PATH. Worked like magic.
If you're not using sounddevice, you can also download those same precompiled DLLs from here:
https://github.com/spatialaudio/portaudio-binaries
That's all. Hope it helps!
As the selected answer didn't work for me, because I'm using virtualenv, I put my working solution here.
For me, the working solution is to add _sounddevice_data folder where the .exe file is located then making a portaudio-binaries folder in it and finally putting libportaudio64bit.dll in the recently created folder.
Hope it helps!

Launch Labview program through Python

I am working on a project in which I have to launch a VI (Labview program) through my GUI written in python. I have not the administrator rights so I installed PyCharm Community with the JetBrain Toolbox and Python 3.3 with an MSI file.
I read on the internet that to do what I want, I need to install the pywin32 extension: extension -link, but when I launch it, it doesn't find my Python installation.
So, my question is: is there another way to control VI from python?
Thank you in advance for your answer. I am a beginner in both languages.
If you want to run a plain VI, you have to run the LabVIEW IDE -- a
VI is a source code file, not a built executable, so to run directly,
it has to be hosted in the editor.
If you want to run a VI built into
an executable, you obviously have to run that built EXE.
So, either way, you're going to have to be able to launch an EXE.
Can your Python invoke C-style DLLs? If so, you could build your VI into a DLL and then call the VI that way.

Error installing Pygame / Python 3.4.1

I'm trying to install Pygame and it returns me the following error "Python version 3.4 required which was not found in the registry". However I already have the Python 3.4.1 installed on my system. Does anyone know how to solve that problem?
I've been using Windows 8.1
Thanks in advance.
Are you using a 64-bit operating system? Try using the 32-bit installer.
Tips I can provide:
Add Python to your Path file in the Advanced settings of your Environmental Variables (just search for it in the control panel)
Something may have gone wrong with the download of Python, so re-install it. Also don't download the 64-bit version, just download the 32-bit version from the main pygame website
Once that's sorted out, transfer the entire Pygame file to the site packages in the Python directory and open up the pygame file and go to this directory in command prompt. Finally, run the Pygame setup from the command prompt which should be something like:
python setup.py
But this will only work if the pygame setup file is called setup.py (it's been a while since I downloaded it), you added Python to the Path file and you're currently in the correct directory in command prompt.
To test if it worked try importing pygame and see if you got an error or not.

Resources