pygtk

How to draw any GTK widget on top of Cairo surface

删除回忆录丶 提交于 2019-12-18 04:39:15
问题 I would like to save the looks of a GTK window, and all the buttons and other widgets it contains to a PNG or PDF file. Cairo supports drawing on such surfaces. Could I somehow ask a GTK widget to draw itself on Cairo surface? A code sample would be much appreciated, since I am a newcomer to both GTK and Cairo. Python is my language of choice. 回答1: In C, you can put your buttons and widgets in a GtkOffscreenWindow using gtk_widget_reparent() and then use gtk_offscreen_window_get_pixbuf() to

Progress bar not updating during operation

自闭症网瘾萝莉.ら 提交于 2019-12-18 01:19:51
问题 in my python program to upload a file to the internet, im using a GTK progress bar to show the upload progress. But the problems that im facing is that the progress bar does not show any activity until the upload is complete, and then it abruptly indicates upload complete. im using pycurl to make the http requests...my question is - do i need to have a multi-threaded application to upload the file and simultaneously update the gui? or is there some other mistake that im making? Thanks in

python pygtk windows 7 64 bit

眉间皱痕 提交于 2019-12-17 23:14:27
问题 I have been working with pygtk on linux for some time.I just want to make my app more distributable. Now I have used pygtk for 32 bit, but now I'd like to use pygtk for 64bit using pygtk 64bit. I have downloaded the all in one installer. I have changed my path as gtk would want and run the "pkg-config --cflags gtk+-2.0" command then ran the gtk-demo command and it did give me a demo and that works perfectly! Just I am missing someting because there in still no module named 'gtk' in my python

Virtualenv on Ubuntu with no site-packages

风流意气都作罢 提交于 2019-12-17 22:11:11
问题 I've been using virtualenv lately while developing in python. I like the idea of a segregated development environment using the --no-site-packages option, but doing this while developing a PyGTK app can be a bit tricky. The PyGTK modules are installed on Ubuntu by default, and I would like to make a virtualenv (with --no-site-packages) aware of specific modules that are located elsewhere on the system. What's the best way to do this? Or should I just suck it up and drop the --no-site-packages

Installing PyGtk in virtualenv

谁都会走 提交于 2019-12-17 18:12:08
问题 So I am trying to run a simple matplotlib example in my virtualenv (in the console). Here's the code: import matplotlib matplotlib.use('GTKAgg') import matplotlib.pyplot as plt radius = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] area = [3.14159, 12.56636, 28.27431, 50.26544, 78.53975, 113.09724] plt.plot(radius, area) plt.show() However, when I run this I get: ImportError: Gtk* backend requires pygtk to be installed. And now the fun starts. I tried to pip install pygtk but it throws: ********************

Best practices for adding .gitignore file for Python projects? [closed]

吃可爱长大的小学妹 提交于 2019-12-17 05:33:58
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 12 months ago . I'm trying to collect some of my default settings, and one thing I realized I don't have a standard for is .gitignore files. There's a great thread showing a good .gitignore for Visual Studio projects, but I don't see many recommendations for Python and related tools (PyGTK

GtkLabel alignment and padding

戏子无情 提交于 2019-12-14 02:59:07
问题 I have GtkLabel in Glade with X align set to 0, X pad set to 5, Expand set to No. Label is located under horizontal box together with spin button and another label. The problem is that X pad is applied to both, left and right side. I want it to be applied only to right side. What am I doing wrong? 回答1: Xpad is applied to both left and right. Glade 3.10 If you just want to have a margin on the right, then change Margin on the right available in the Common tab: Glade 3.8 Right click on the

draw an image to gtk.DrawingArea?

不想你离开。 提交于 2019-12-13 15:41:20
问题 I'm writing a PyGtk paint program based on the basic tutorial found here. Is there any way to add an image to the drawing area so that you can still draw over the image? Like a stamp, or an imported photo for example. I've tried adding a gtk.Image() but gtk.DrawingArea object has no attribute add . self.window = gtk.Window((gtk.WINDOW_TOPLEVEL)) self.window.set_title ("Canvas") self.window.set_position(gtk.WIN_POS_CENTER) hbox = gtk.HBox(False, 0) self.window.add(hbox) self.window.set

Set cellrenderertext foreground color when a row is highlighted

僤鯓⒐⒋嵵緔 提交于 2019-12-13 14:27:23
问题 When I have a gtk.CellRendererText , I can associate its foreground color with one of the tree store's columns, and set the foreground-set attribute to True, to change the color of the text in that column. However, when the row with the colored column is selected, its color disappears, and is the same as any selected cell's color. How do I change the color when it's selected? 回答1: I've had the same problem and, after trying different alternatives, using the markup property instead of the text

How to download a file browser in Python+Webkit+Gtk?

匆匆过客 提交于 2019-12-13 08:10:11
问题 Here is a simple browser in Python Webkit Gtk: #!/usr/bin/python import gtk import webkit view = webkit.WebView() sw = gtk.ScrolledWindow() sw.add(view) win = gtk.Window(gtk.WINDOW_TOPLEVEL) win.add(sw) win.show_all() view.open("https://www.kernel.org/") gtk.main() Browsing works perfectly. Unfortunately, it does not work to save files on the local computer. I could not find a ready solution. I do not need a progress bar, folder selection, I want to click on the link resulted in downloading.