pygtk

Is there a way to change the current PyGTK theme on Windows?

偶尔善良 提交于 2019-12-12 09:03:09
问题 I've written a Python app that uses PyGTK. It runs fine on Linux and looks great. It also runs fine on Windows, but it looks absolutely awful. The default GTK theme looks absolutely nothing like the native Windows GUI elements. Is there anything I can do to make my Python app look a little better? Perhaps some function I can call to change to theme to something a little nicer? Edit: using the rc_parse() function suggested in the answer below, I now have: import pygtk,gtk gtk.rc_parse("C:\

How to get transparent background in window with PyGTK and PyCairo?

和自甴很熟 提交于 2019-12-12 08:09:27
问题 I've been trying really hard to create a window with no decoration and a transparent background using PyGTK. I would then draw the content of the window with Cairo. But I can't get it to work. I've tried a lot of different ways, they all failed, this is one of them #!/usr/bin/env python import pygtk pygtk.require('2.0') import gtk, sys, cairo win = None def expose (widget, event): cr = widget.window.cairo_create() #Start drawing cr.set_operator(cairo.OPERATOR_CLEAR) cr.set_source_rgba(0.5,1.0

gtk-error **: gtk_text_btree_previous_line ran out of lines aborting

一曲冷凌霜 提交于 2019-12-12 06:48:47
问题 Backstory: I am doing a irc bot with a gui. I have a textbuffer to show chat.(telling the textbuffer thing because I think it might be the problem) The bot runs ok for a couple of seconds and then gives this error: gtk-error **: gtk_text_btree_previous_line ran out of lines aborting... My code is here. The main file is run.py. 回答1: Well im fumb I first tested this code: if chatbuffer.get_line_count() > 10: chatbuffer.delete(chatbuffer.get_iter_at_line(0), chatbuffer.get_iter_at_line(5)) To

Templating overflowing content with glade and pygtk?

我们两清 提交于 2019-12-12 06:43:07
问题 I'm trying to develop a "multitrack" GUI (similar to multitrack audio editors); however, I'd like to develop it in glade first, and check how overflowing content (in this case, multiple "tracks") will behave with scollbars. Then, upon instantiation in Python, I'd first like to take the first of these "multiple tracks" as a "template", then delete all these multiple "tracks" - then allow the user to add new ones based on the "template" by, say, clicking an "Add" button. From the Gtk palette,

PyGTK ProgressBar to display something before subprocess starts

▼魔方 西西 提交于 2019-12-12 05:26:04
问题 I'm trying to get gtk.ProgressBar.set_text('Text') to work when I click on a button, prior to launch my subprocess . Here is my code (full source here): def on_button_clicked(self, button, progress_bar, filename): self.execute(progress_bar, filename) def execute(self, progress_bar, filename): progress_bar.set_text('Encoding') progress_bar.pulse() cmd = ['ffmpeg', '-y', '-i', filename, '-r', '30', '/tmp/test-encode.mkv'] process = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.PIPE) process.wait()

import gtk not working on mac

泪湿孤枕 提交于 2019-12-12 04:58:23
问题 I am new to Python and mac OS. I've Installed py27-pygtk-2.24.0_3 from macports . I tried to run the following: #!/opt/local/bin/python2.7 import gtk window=gtk.Window() window.connect("destroy", gtk.main_quit) button=gtk= gtk.Button("Hello") window.add(button) window.show_all()\gtk.main() I am executing the file through Python Launcher and get this error: Import error:No module named GTK I spent the whole day searching for answer. Can someone help me and make it work? 回答1: First of all, you

Creating Clickable areas on screen with PyGtk

拈花ヽ惹草 提交于 2019-12-12 02:45:47
问题 Hey guys I've run into a problem that I don't know how to solve. I just met with a team to design a GUI in python using PyGtk. I need to make a GUI that has clickable areas on screen. I need to divide the screen up into 12 equal areas with one square one in the centrer. Like this: http://imgur.com/PMT3m I thought about using buttons but buttons are rectangular. Is it possible to make buttons that are a different shape like those show in the picture? If i can would those buttons resize if I

Python spynner and gtk3 issue

陌路散爱 提交于 2019-12-11 21:13:28
问题 I am always getting the following error on executing the script. I am trying to attach spynner window in a Gtk window. Is spynner will only works with gtk2?? import sys import spynner from BeautifulSoup import BeautifulSoup from gi.repository import Gtk, Gdk from gi.repository import GObject, GLib class App: def __init__(self): self.browser = spynner.Browser() self.create_interior() self.window.show_all() def create_interior(self): self.window = Gtk.Window() self.window.set_border_width(0)

replace image using gtk.image.set_from_file

妖精的绣舞 提交于 2019-12-11 19:39:18
问题 I'm trying to add and if needed by user, change the image from a widget in python. I'm using Glade with gtk2+, python 2.7.3, and these is what I'm doing image = gtk.Image() image.set_from_file("MyImagePath.png") image.show() button = App.get_object('buttonExample') button.add(image) and this is what I get when try to change the image GtkWarning: Attempting to add a widget with type GtkImage to a GtkAspectFrame, but as a GtkBin subclass a GtkAspectFrame can only contain one widget at a time;

How can I pass variables between two classes/windows in PyGtk?

ε祈祈猫儿з 提交于 2019-12-11 17:53:08
问题 I am starting out with PyGtk and am having trouble understanding the interaction of windows. My very simple question is the following. Suppose I have a class that simply creates a window with a text-entry field. When clicking the "ok" button in that window, I want to pass the text in the entry field to another window, created by another class, with a gtk menu and create a new entry with the content of the text field. How do I implement this? 回答1: Let's call A the Menu, and B the window with