gtk

Cairo context and persistence?

不想你离开。 提交于 2020-02-02 06:32:43
问题 I am just getting started using pycairo, and I ran into the following interesting error. The program I write creates a simple gtk window, draws a rectangle on it, and then has a callback to draw a random line on any kind of keyboard input. However, it seems that with each keyboard input, I have to create a new context, or I get an error at the moment the program receives first keyboard input (specifically, on the .stroke() line). Error is as follows, if it matters. 'BadDrawable (invalid

Cairo context and persistence?

扶醉桌前 提交于 2020-02-02 06:31:32
问题 I am just getting started using pycairo, and I ran into the following interesting error. The program I write creates a simple gtk window, draws a rectangle on it, and then has a callback to draw a random line on any kind of keyboard input. However, it seems that with each keyboard input, I have to create a new context, or I get an error at the moment the program receives first keyboard input (specifically, on the .stroke() line). Error is as follows, if it matters. 'BadDrawable (invalid

Painting on GtkScrolledWindow or GtkEventBox

只愿长相守 提交于 2020-02-02 04:07:26
问题 Using GTK, I'm trying to overlay a "More" prompt (but it could just as well be any drawing object) in the corner of a GtkTextView contained within a GtkScrolledWindow . I draw the prompt in the handler for the expose signal of the text view. It works, but when I scroll the window I get artifacts: the prompt is moved along with the contents of the text view and not erased. In order to get rid of the artifacts I trigger a redraw after each scroll. This mostly works, but you can still see the

Cannot reduce size of gtk window programatically

混江龙づ霸主 提交于 2020-01-30 10:47:40
问题 I seem to be facing a problem when resizing a gtk window programatically. The problem is that once I have increased the width and height of the window to 800x600, I cannot seem to reduce it back to its original size of 400x200. Below is the sample code. Has anyone faced such a problem? #include <gtk/gtk.h> static gboolean is_clicked = FALSE; static void Child_window_resize( GtkWidget *widget, GtkWidget *window) { if(!is_clicked) { g_print("Inside If block increase bool value %d\n",is_clicked)

Alternative way to handle GTK+ events in Rust

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-30 08:39:07
问题 Currently, I manage GTK+ events with Rc and RefCell as shown in the following example: extern crate gtk; use std::cell::RefCell; use std::rc::Rc; use gtk::{Button, ButtonExt, ContainerExt, Inhibit, Label, WidgetExt, Window, WindowType}; use gtk::Orientation::Vertical; struct Model { count: i32, } fn main() { gtk::init().unwrap(); let window = Window::new(WindowType::Toplevel); let model = Rc::new(RefCell::new(Model { count: 0 })); let vbox = gtk::Box::new(Vertical, 0); window.add(&vbox); let

Python Gtk - set_visible works temperamentally

半世苍凉 提交于 2020-01-25 20:37:31
问题 I have a window which has two dropdown lists (country and club) which should never be visible at the same time. When the app loads, neither should be visible. A third dropdown list (tournament type), with nothing selected by default, decides which of the club or country lists should display. Clicking on a button at the top of the screen populates the dropdown lists, selecting the appropriate tournament type and the associated club/or country. What actually happens: When it loads, both

Does MinGW influence compilation — a GTK program

会有一股神秘感。 提交于 2020-01-25 04:41:05
问题 I compiled a GTK program in MinGW environment. It worked perfect. Recently, I updated MinGW and recompiled the GTK program, then the program always stopped with Segmentation fault. I have tried to use gdb to look for errors but I couldn't. The config of GTK is exactly same in the old and new MinGW. Therefore, I am suspicious of MinGW environment that influences compilation. I found the version of gcc is different in two environment: old MinGW new MinGW gcc 3.4.5 4.7.2 Any idea? Does anybody

Using markup with Gtk.TextView

不羁的心 提交于 2020-01-25 00:43:13
问题 I have been trying to find a way to use Pango markup with Gtk.TextView and Gtk.TextBuffer in Python GObject , but it seems like this functionality is only available for tooltips and labels. Gtk.TextBuffer has the insert_markup method, but requires Gtk.TextIter as input, and must be of specified length. The issue here is that I want to use Gtk.TextView only for displaying text without it being editable. So while I think I understood how you use Gtk.TextTag with editable/selectable text to

Gtk Keybinder does not respond

左心房为你撑大大i 提交于 2020-01-24 15:37:10
问题 I'm using a Keybinder in a Gtk+3 application, but it doesn't get any key combinations. Here's the code: #!/usr/bin/env python # -*- coding: utf-8 -*- import gi gi.require_version('Keybinder', '3.0') from gi.repository import Keybinder from gi.repository import Gtk def test_func(data): print data if __name__ == '__main__': wnd = Gtk.Window() wnd.connect('delete-event', Gtk.main_quit) wnd.show_all() if not Keybinder.bind('<Super>q', test_func, 'Hi there!'): print "Keybinder.bind() failed." Gtk