Antony Geek 2.0
Posts: 4
Joined: Sun Oct 29, 2017 4:14 pm

Graphic window for python GTK compiler Geany

Sun Oct 29, 2017 4:25 pm

Hi, I'm programming on the Geany compiler on a Raspberry pi 3 and I can not seem to get a kind of graphical plug-in to run my program properly.
When I run my GTK python program on Geany, a ".sh" terminal opens and does not affect anything.
My program is supposed to open a graphic window. I specify that this program runs correctly on the Raspberry pi of my school.
Could you tell me what is my problem? the configuration of Geany? a GTK library to install?

Here is the beginning of my program :

Code: Select all

#! / usr / bin / env python
# - * - coding: utf-8 - * -
import gtk
import gobject
import pygtk
import RPi.GPIO as GPIO
import time
Thank you

User avatar
buja
Posts: 498
Joined: Wed Dec 31, 2014 8:21 am
Location: Netherlands

Re: Graphic window for python GTK compiler Geany

Sun Oct 29, 2017 4:46 pm

I think you will find this useful: viewtopic.php?f=66&t=191818#p1203549

With the upgrade to Raspbian Stretch something has changed in the behaviour of either Geany or lxterminal, and because of that the terminal dow does not work properly anymore. But it's an easy change to make it work again.

Having said that, I have never tried to open a graphic window. But I suppose if Geany opens a normal terminal window, everything should work as before.

Antony Geek 2.0
Posts: 4
Joined: Sun Oct 29, 2017 4:14 pm

Re: Graphic window for python GTK compiler Geany

Sun Oct 29, 2017 5:20 pm

Thank you for your help.
I did exactly what is written and the program "print 'fred'" works in the terminal but I want to open a graphic window gtk.

The library I want to have are this one :

Code: Select all

import gtk
import gobject
import pygtk

User avatar
buja
Posts: 498
Joined: Wed Dec 31, 2014 8:21 am
Location: Netherlands

Re: Graphic window for python GTK compiler Geany

Sun Oct 29, 2017 7:02 pm

I am afraid the Geany part is the only thing I can help you with, I hope someone else can help you with the graphical part of your question.

Antony Geek 2.0
Posts: 4
Joined: Sun Oct 29, 2017 4:14 pm

Re: Graphic window for python GTK compiler Geany

Tue Oct 31, 2017 10:31 am

Thank you, somebody knows GTK library ?

User avatar
PeterO
Posts: 5006
Joined: Sun Jul 22, 2012 4:14 pm

Re: Graphic window for python GTK compiler Geany

Tue Oct 31, 2017 10:58 am

Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Antony Geek 2.0
Posts: 4
Joined: Sun Oct 29, 2017 4:14 pm

Re: Graphic window for python GTK compiler Geany

Tue Oct 31, 2017 1:53 pm

Thank you.
I did everything that is written. The program "Hello world" works but I would like to install GTK +2, I do not want python 3 but python.
How to install gobject ?
I want to run this program :

Code: Select all

#!/usr/bin/python
# -*- coding: utf-8 -*-
import gtk
import gobject
import pygtk

my_window = gtk.window()
my_window.set_title('Hello world')
my_window.resize(400,200)
my_window.connect("destroy",gtk.main_quit)
my_window.show()
gtk.main()
Your sincerely
Antoine

Return to “Python”