I'm practicing in GTK3-based GUI development on python3 and since I'm beginner both in programming or python or GTK3-framefork, I wish to look at examples of serious working programs written this way. My current desktop OS is Linux Mint 19.3 with XFCE environment, and I see that several graphical utilities included with distro built on GTK3 library.
So I assume the most dumb but simple way to get what I want is grepping all text files at /usr/share/* which contains
import gi or gi.require_version("Gtk", "3.0") or from gi.repository import Gtk lines.
But, may be there is more elegant and intelligent way to find desired packages by using package management systems (pip or apt-derivated)? I'm afraid that potentially interesting packages will be turned out of grep scope, because they are installed at any other unusual directory or using different importing instructions.
Related
Obviously Tkinter code under linux and windows are different, but I have never seen a tutorial or documentation that mentions that. Most books on python and tkinter are written for linux platforms. I wonder if there are any books written specifically for windows?
It's not that obvious: the code itself is really the same but, of course, the GUI is builded with different libraries in runtime. The result is that the appearance of the GUI change in different OSs.
I am using the Anaconda distribution of Python 3.6 on Windows and I wish to convert a simple python script to a standalone executable file. The problem is that the generated file is extremely large (~900mb) while using only a few external libraries.
More specifically, I use PyQt5 and pyqtgraph and some integrated python libraries such as sys, time, os and math. So far I have used PyInstaller and Nuitka, but I can't seem to be able to drastically reduce the executable file's size.
I noticed the existence of some mkl files that take up roughly 600mb of space. After removing those files, I was still able to run my program, seemingly without a hitch. I also noticed that there are two files named libopenblas which seem to be vital for the operation of the program and which amount to 100mb in total.
I have looked into this matter and I found similar questions on Stackoverflow and other sites. People claim that they were able to generate exe files using PyInstaller which were less than 40mb. It is being said that in order to achieve this size reduction, one should exclude all clutter libraries. However, I do not understand what qualifies as "clutter". For example, I tried excluding numpy and the program did not run, notwithstanding the fact that I wasn't directly using it in my program. Apparently, the libraries that are being used have some dependencies without which the program can't run.
Finally, I found this forum where it is suggested that a virtual environment be used instead of Anaconda. I tried setting it up using venv but I have trouble implementing it, as my Anaconda intallation interferes with it and does not allow me to install all the necessary libraries afresh.
No matter what I do, I always end up with at least 200mb worth of data. How can I get a functional executable that is less than 40mb of size? If a simple program like this produces such a large file, imagine what I will end up with if I decide to integrate other libraries such as tensorflow or scipy. It is not a viable solution and so far I haven't figured out a way to go around it. Any help is greartly appreciated.
EDIT: I tried installing Python from its official website and I removed Anaconda from Path. I ended up with a slightly smaller file which did not run though.
I realize this is old but I came across it today and have worked the same problem.
A Pyinstaller hello world program will compile to about 12 Mb. However, as soon as you start doing anything substantial, numpy is required, which is large.
I have one program that requires
paramiko
scp
it compiles to 12 Mb.
I have another that requires
numpy
tqdm
nomkl
matplotlib
It compiles to ~200 Mb (zips to ~75 Mb). Using the nomkl package gets the installer to automatically keep the mkl libraries out. You have to remove numpy and then install nomkl and reinstall numpy. Without nomkl the above program was about 1 Gb.
I recommend using conda environments rather than virtual environments if you have anaconda installed.
I have installed OCaml on my xfce and now I want to do some graphics program.
The problem is that I don't know how I can install graphics.cma ( I think it's this file that I need but i'm not sure ).
I have research on Google and in This forum but I can't find it..
After little search, I see that i have graphics.cma and graphics.cmxa .
I found this with ls $(ocamlc -where) | egrep cmx?a
I don't know why but yet, my graphics function work at all.
Sorry for inconvenience.
Thanks for helping me guys.
Have a nice day
I would suggest installing and using ocamlfind in order to not have to worry about library location:
ocamlfind ocamlc -package graphics -linkpkg test.ml
will compile your file with the right files loaded.
You can also load the package in the toplevel using
#use "topfind";;
#require "graphics";;
You have already installed the graphics module.
On Debian based systems the ocaml package is split into ocaml-base-nox and ocaml-base. The later contains the graphics module while the former is trimmed down.
The ocaml package is a meta package that depends on both of those and the description says (at the end):
This package contains everything needed to develop OCaml applications,
including the graphics libraries.
So you are all set to play with graphics. Juliens answere of installing ocamlfind is a good idea though as it makes using graphics and other modules easier.
I am learning python from a video tutorial series that uses a GUI called 'simpleGUI'.
It is not inbuilt in python so I had to download install a similar module called 'simpleGUITK'.
I'm new to python and I wish to know if there is any inbuilt module that I can import without any installation (like I important math or random) which is same as (or at least similar to) simpleguitk?
Because I might need to send some py files to a friend who might not be having the simpleguitk module.
To my knowledge there is no GUI module in the standard library. However, some, like Tkinter, are included with most Python distributions.
I strongly advise that you have a look at the GUI FAQ in the official documentation.
A standard build of python includes tkinter. From the GUI FAQ:
Standard builds of Python include an object-oriented interface to the
Tcl/Tk widget set, called tkinter. This is probably the easiest to
install (since it comes included with most binary distributions of
Python) and use. For more info about Tk, including pointers to the
source, see the Tcl/Tk home page. Tcl/Tk is fully portable to the Mac
OS X, Windows, and Unix platforms.
I want to know whether we need to download GTK for making graphical interfaces in C on linux, since i have read somewhere that it is by default installed.
You have a number of choices for a GUI on Linux. Most distros ship with x11 at least, though you will have to design the controls yourself. GTK and QT are two common toolkits, which have their own look and feel (of course QT isn't C).
There exist a lot of library to do GUI in linux. Some are installed by default depending on the Distribution and your environment (eg: gnome come with GTK).
You can also want to use other library like qt... (with may required an installation if it is not provided in your distribution, but nowadays, It is really easy to install such library eg: apt-get, yum, rpm...)