gtk3

Python GTK3: how to create a Gtk.FileChooseDialog?

倖福魔咒の 提交于 2019-12-05 21:28:41
How to create a Gtk.FileChooseDialog properly? This popular tutorial says to use code like the following: import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk dialog = Gtk.FileChooserDialog("Please choose a folder", None, Gtk.FileChooserAction.SELECT_FOLDER, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, "Select", Gtk.ResponseType.OK)) But, if you run this with python -W error (to catch the deprecated warnings) it says: File "test3.py", line 8, in <module> "Select", Gtk.ResponseType.OK)) File "/usr/lib/python2.7/dist-packages/gi/overrides/__init__.py", line 287, in new_init

How to create a live updating matplotlib graph in gtk3

浪尽此生 提交于 2019-12-05 18:05:18
I wanted to put my live plotting app into a nice gtk3 programm and so far I got this but it doesn't show a window. What am I missing? Thanks in advance! import serial import numpy as np from matplotlib.figure import Figure from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo as FigureCanvas from gi.repository import Gtk class MyWindow(Gtk.ApplicationWindow): def __init__(self): Gtk.Window.__init__(self, title="Toolbar Example") self.set_size_request(700, 500) self.box = Gtk.Box(spacing=6, orientation=Gtk.Orientation.VERTICAL) self.add(self.box) fig = Figure() ax = fig.add

How do I change a Gtk3 Entry text color in Python3?

拈花ヽ惹草 提交于 2019-12-05 13:21:49
I have a list of Gtk.Entry() in my application, and I would like to change the color of the text of some of them. I tried the following : #!/usr/bin/python3 # Filename: mywindow.py from gi.repository import Gtk from gi.repository import Gdk class MyWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="My window") self.mainGrid = Gtk.Grid() self.add(self.mainGrid) self.myOkEntry = Gtk.Entry() self.myOkEntry.set_text("This is OK (green)") self.myOkEntry.override_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(0.0, 1.0, 0.0, 0.0)) self.mainGrid.add(self.myOkEntry) mainWin = MyWindow()

Window doesn't show in python interpreter in GTK3 without Gtk.main()

依然范特西╮ 提交于 2019-12-05 12:47:51
In GTK2, I enjoyed building a gui in the interpreter (ipython or plain python) "on the fly" and seeing the changes in real time like this: >>> import gtk >>> win = gtk.Window() >>> win.connect('delete-event', gtk.main_quit) 10L >>> win.show_all() Which will result in showing a window to which I could add objects. I'm changing to Gtk3 in part because it is the future and in part because I sometimes use Glade which now is only Gtk3. In doing the same with GTK3 DOESN'T show the window: >>> from gi.repository import Gtk >>> win = Gtk.Window() >>> win.connect('delete-event', Gtk.main_quit) 13L >>>

Unable to connect signal and signal handler in Glade GTK+3

蓝咒 提交于 2019-12-05 12:41:44
Hi i'm working on a project in GTK+ 3 on Ubuntu 14.04 LTS. I'm trying to use Glade,but when i tried to connect a "toggled" signal of toggle button to a function called kaczka ,after compiling i got this in my console: (Gra_w_Statki:11072): Gtk-Warning**:Could not find signal handler 'kaczka. Did you compile with -rdynamic? The window and the button render itself and work normally except of that toggling button doesn't change anything. What am i doing wrong ? This is how i tried to connect toggle button and function Click! My Linker Settings are : pkg-config --libs gtk+-3.0 And my compiler

How do I raise a window that is minimized or covered with PyGObject?

我的未来我决定 提交于 2019-12-05 09:26:46
I'd been using the answer provided in the PyGTK FAQ , but that doesn't seem to work with PyGObject. For your convenience, here is a test case that works with PyGTK, and then a translated version that doesn't work with PyGObject. PyGTK Version: import gtk def raise_window(widget, w2): w2.window.show() w1 = gtk.Window() w1.set_title('Main window') w2 = gtk.Window() w2.set_title('Other window') b = gtk.Button('Move something on top of the other window.\nOr, minimize the' 'other window.\nThen, click this button to raise the other' 'window to the front') b.connect('clicked', raise_window, w2) w1

How to hide a Gtk+ FileChooserDialog in Python 3.4?

假如想象 提交于 2019-12-05 08:28:27
I have a program set up so that it displays a FileChooserDialog all by itself (no main Gtk window, just the dialog). The problem I'm having is that the dialog doesn't disappear, even after the user has selected the file and the program has seemingly continued executing. Here's a snippet that showcases this issue: from gi.repository import Gtk class FileChooser(): def __init__(self): global path dia = Gtk.FileChooserDialog("Please choose a file", None, Gtk.FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK)) self.add_filters(dia) response =

Webkit threads with PyGObject on Gtk3

北慕城南 提交于 2019-12-05 07:01:00
I am trying to load a webkit view on a different thread than main thread for gtk. I see the example PyGTK, Threads and WebKit I slightly modify for support PyGObject and GTK3: from gi.repository import Gtk from gi.repository import Gdk from gi.repository import GObject from gi.repository import GLib from gi.repository import WebKit import threading import time # Use threads Gdk.threads_init() class App(object): def __init__(self): window = Gtk.Window() webView = WebKit.WebView() window.add(webView) window.show_all() #webView.load_uri('http://www.google.com') # Here it works on main thread self

Python3 + PyGobject + GTK3 and cx_freeze missing DLLs

北城以北 提交于 2019-12-05 03:43:07
问题 When I make a exe from py python3 + pygobject + gtk3 application using the setup.py from pygobject site it misses some DLL files. what files are missing? 回答1: I have manualy tried what DLLs are required. So if this will help someone: the setup.py must be edited. the missing_dlls list must be: missing_dll = ['libgtk-3-0.dll', 'libgdk-3-0.dll', 'libatk-1.0-0.dll', 'libcairo-2.dll', 'libcairo-gobject-2.dll', 'libgdk_pixbuf-2.0-0.dll', 'libjpeg-8.dll', 'libpango-1.0-0.dll', 'libpangocairo-1.0-0

ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded

时光怂恿深爱的人放手 提交于 2019-12-05 02:31:35
Running into this issue when working with Hugo and the AWS CLI on Ubuntu 18.04. ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (failed to map segment from shared object): ignored. This is a fresh install of Ubuntu 18.04, Hugo, and AWS CLI. Found the answer after a bit of web searching here: https://github.com/PX4/Firmware/issues/9409 If you update your .bashrc with the below line it should fix the issue: export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 In addition, you may need to install the following package: sudo apt install gtk3-nocsd Another