Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up developement environment: PyCharm, python-gtk, windows

I want to develop with these tools:

  • MS-Windows 10
  • Python3
  • gtk
  • PyCharm

I installed PyCharm, but up to now Python and gtk are not installed up to now.

Sub questions:

  • use 32 or 64 Bit version of Python?
  • How to install gtk for python (pip or exe)?
  • Use virtual env in PyCharm or use "Existing Interpreter"?

AFAIK you cant install gtk for Python on Windows with pip.

Update

I follow this guide now: https://pygobject.readthedocs.io/en/latest/getting_started.html#windows-getting-started

Update2

gtk on windows seems to be hardly used. There were many strange things, and I use pyside2 (QT) now and I am happy

like image 815
guettli Avatar asked Aug 10 '18 13:08

guettli


2 Answers

use 32 or 64 Bit version of Python?

The documentation suggests 32 bit for msys2, so this is the safest. However, if you have a 64 bit computer, the 64 bit version could allow some more processing power for larger tasks.

How to install gtk for python (pip or exe)?

Most definitely using the .exe available from this source. This tool is a package manager for Windows that will let you install gtk and its dependencies. Instructions there will walk you through setting up the default environment, then from that environment run pacman -Suy and pacman -S mingw-w64-i686-gtk3 mingw-w64-i686-python2-gobject mingw-w64-i686-python3-gobject.

Use virtual env in PyCharm or use "Existing Interpreter"?

Using the 'Existing Intepreter' is a must for this method of installation, as you need to point PyCharm to your msys2 Python, which actually has gtk available. It should be located at C:\msys64\bin\python.exe. Keep in mind that you might not be able to run some scripts directly through PyCharm this way, as Python will be running through a virtual bash-like environment. Save your scripts in the C:\msys64\home\<username> directory so that you can run them easily when you open msys2 with python3 script.py.

like image 155
J. Blackadar Avatar answered Sep 25 '22 07:09

J. Blackadar


use 32 or 64 Bit version of Python?

You can pick any, it doesn't really matter.

how to install gtk for python (pip or exe)?

You should able to install it with pip: pip install pygtk.

Use virtual env in PyCharm or use "Existing Interpreter"?

If you don't know, you probably need "Existing interpreter". There should be an option to select path to your python.exe It should be there: Menu->File->Settings->Project->Project Interpteter

like image 22
Rugnar Avatar answered Sep 21 '22 07:09

Rugnar