pygtk

JSON encode/decode GTK enums

允我心安 提交于 2019-12-10 10:22:59
问题 I have to save various properties of custom GTK elements to a file for future use and decided to use JSON because of the simple format and nesting of dicts. Many properties are GTK enums, like gtk.PAGE_ORIENTATION_PORTRAIT , gtk.ANCHOR_CENTER and pango.ALIGN_LEFT . They have a unique name which can be retrieved with obj.value_name to get a valid JSON type. Currently I have 2 methods for each of my elements: to_str() to get the value_name and from_str() which maps the str to the enum again. I

python pygtk how to put a window on a specific display monitor

╄→尐↘猪︶ㄣ 提交于 2019-12-10 10:00:45
问题 I'm using Python PyGTK library on OS Linux based (suse, ubuntu) Working on devices with multiple Display Monitors. I'm trying to put a Full Screen Window (in python, gtk.Window) on a Specific Display monitor connected to the Device. I'm using the following code: n_monitors = gtk.gdk.Screen.get_n_monitors() # Get number of monitors. gtk.gdk.Screen.get_monitor_geometry(*monitor_number*) # Get the size of a specific monitor. The second api returns the monitor size and offset information. gtk

Adding GUI Window to python opencv2 program with pygtk3

核能气质少年 提交于 2019-12-10 06:55:49
问题 I have completed a program using Python and Opencv2. Now, I wants to add a GUI Window to my program. I am having some experience with PyGtk3. So, I modified my code to adopt with PyGtk3. But, I got errors. So, I tried a simple program to find out the actual mistake. My testing code is, import pygtk pygtk.require('2.0') import gtk import numpy as np import cv2 builder = gtk.Builder() builder.add_from_file("GUI.glade") window = builder.get_object("window1") window.set_title("Single Object

pygtk how to embed external application within my pygtk GUI

匆匆过客 提交于 2019-12-10 03:57:44
问题 I'm desiging a pygtk GUI and want to embed an external application into it. Does anyone have any idea how this can be done? 回答1: It depends on what application you are trying to embed into yours, but if the other app is a GTK app (or one that supports the XEMBED protocol), you should be able to do this with gtk.Plug and gtk.Socket. The PyGTK tutorial has a section explaining how to do this: http://www.pygtk.org/pygtk2tutorial/sec-PlugsAndSockets.html 回答2: This one might help. Read the article

python locale for gtk does not work on windows

倾然丶 夕夏残阳落幕 提交于 2019-12-09 13:23:18
问题 I have python 2.7 and pygtk. I am trying to set locale language for gtk in my application but no luck. My windows is in slovak language and I would like to have button labels in my app in english. How to solve it? I tried this but no luck (all labels are still in slovak): import os os.environ['LANGUAGE'] = 'en_US' #tried en_UK as well os.environ['LANG'] = 'en_US' os.putenv('en_US', 'LANG') import locale locale.setlocale(locale.LC_ALL, 'English_United Kingdom.1252' ) but when I make cmd file

Right Click Menu (context menu) using PyGTK

拜拜、爱过 提交于 2019-12-09 09:20:45
问题 So I'm still fairly new to Python, and have been learning for a couple months, but one thing I'm trying to figure out is say you have a basic window... #!/usr/bin/env python import sys, os import pygtk, gtk, gobject class app: def __init__(self): window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_title("TestApp") window.set_default_size(320, 240) window.connect("destroy", gtk.main_quit) window.show_all() app() gtk.main() I wanna right click inside this window, and have a menu pop up like

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

狂风中的少年 提交于 2019-12-09 03:32:31
问题 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

Python classes losing attributes

你。 提交于 2019-12-08 23:44:06
问题 I have a peculiar python problem. During the course of execution of my gtk python application, some of my class objects mysteriously lose attributes, causing some of the functionality of my program to break. It's hard to give a sense of why this might happen - I never intentionally delete attributes, and the classes in question inherit from a class I wrote myself (and no others). I can trigger the problem by doing a certain action repeatedly (for example generating many calls to the add_card

Learning GUI programming with GTK+2 or GTK+3?

牧云@^-^@ 提交于 2019-12-08 17:59:25
问题 I am new to GUI programming, and I haven't found yet what library is best for my purpose (i want to make desktop environment applications, eg. docks, panels, desklets etc.) I have started learning basics of GTK, mainly using PyGtk. Most tutorials i found on line are for GTK+2.0. Recently however, GTK+3 has been released. So i am a bit unsure as to what that means for my learning curve: Should i learn using GTK+3 and forget about GTK+2? Does using one or the other really makes a difference

Is there a way to uncheck all radio buttons in a group? (PyGTK)

北慕城南 提交于 2019-12-08 17:05:31
问题 Is there a way to uncheck all radio buttons in a group with PyGTK? No radio buttons are checked on startup, so I think there must be a way to return them all to that unchecked state. 回答1: There shouldn't be. By their nature, a radio button group is a 'pick one of many' type of control. From a human perspective, the idea is that one of them is always selected. The framework really should enforce that, so there really shouldn't be a 'none selected' state for the group. The none-selected state