I tried grabbing a pixbuf of my screen, but I fail to retrieve the window surface using "offscreen_window_get_surface".
Are there any other API endpoints to grab the surface of the root window, or am I missing something?
Here's the code: https://gist.github.com/eHammarstrom/cf465d20690368dc1f5f9a7aaa482ff1
Hey guys, I would like to draw nodes and lines between those nodes. These graphs will be used to simulate algorithms on them. At which structs should I take a look?
My use case is:
gondolyr
Hey everyone, I'm looking to start a project with libhandy but when I go to build, I get failed to add UI: .:7:1 Invalid object type 'HdyApplicationWindow'
. I've installed libgtk-3-dev
and libhandy-0.0-0
, though I'd like to use libhandy-1
when it's available from the Debian repository. Also, if anyone has a handy tutorial, I'd appreciate that as well.
mmstick
> <@vancha112:matrix.org> hey everyone ^^ I'm looking to increase the size of my text in gtk-rs. I knew that gtk could make use of css for increasing for example text size, but I don't know how to do so in gtk-rs :(
You could use CSS, but pango also works for modifying text attributes.
use gtk::prelude::*;
fn main() {
if let Err(msg) = gtk::init() {
println!("Failed to initialize GTK: '{}'", msg);
return;
}
let layout_src = include_str!("../res/gui_layout.glade");
let builder = gtk::Builder::from_string(layout_src);
let window: gtk::Window = builder.get_object("window").unwrap();
window.show_all();
gtk::main();
}
mmstick
It won't do anything here since gtk::main_quit()
will quit the application
Timo
Is it broken atm?
Timo
gtk-rs/examples4#8
Timo
That us the error message:error: failed to select a version for `gsk4-sys`.
... required by package `gtk4 v0.1.0 (https://github.com/gtk-rs/gtk4#8aeb9dce)`
... which is depended on by `gtk-rs-examples4 v0.0.1 (/home/timo/Programming/RustExperiments/examples4)`
versions that meet the requirements `*` are: 0.1.0
the package `gsk4-sys` links to the native library `gtk-4`, but it conflicts with a previous package which links to `gtk-4` as well:
package `gdk4-sys v0.1.0 (https://github.com/gtk-rs/sys#dbd887f1)`
... which is depended on by `gdk4 v0.1.0 (https://github.com/gtk-rs/gdk4#bf87233c)`
... which is depended on by `gtk-rs-examples4 v0.0.1 (/home/timo/Programming/RustExperiments/examples4)`
failed to select a version for `gsk4-sys` which could resolve this conflict
Timo
* That is the error message:error: failed to select a version for `gsk4-sys`.
... required by package `gtk4 v0.1.0 (https://github.com/gtk-rs/gtk4#8aeb9dce)`
... which is depended on by `gtk-rs-examples4 v0.0.1 (/home/timo/Programming/RustExperiments/examples4)`
versions that meet the requirements `*` are: 0.1.0
the package `gsk4-sys` links to the native library `gtk-4`, but it conflicts with a previous package which links to `gtk-4` as well:
package `gdk4-sys v0.1.0 (https://github.com/gtk-rs/sys#dbd887f1)`
... which is depended on by `gdk4 v0.1.0 (https://github.com/gtk-rs/gdk4#bf87233c)`
... which is depended on by `gtk-rs-examples4 v0.0.1 (/home/timo/Programming/RustExperiments/examples4)`
failed to select a version for `gsk4-sys` which could resolve this conflict
felinira
What is the difference between https://github.com/gtk-rs/gtk-rs/tree/master/glib and https://github.com/gtk-rs/glib ?
error[E0432]: unresolved import `gtk_sys`
--> src/lib.rs:9:5
|
9 | use gtk_sys as gtk;
| ^^^^^^^^^^^^^^ no `gtk_sys` in the root
error[E0432]: unresolved import `glib_sys`
--> src/lib.rs:10:5
|
10 | use glib_sys as glib;
| ^^^^^^^^^^^^^^^^ no `glib_sys` in the root
error[E0432]: unresolved import `gobject_sys`
--> src/lib.rs:11:5
|
11 | use gobject_sys as gobject;
| ^^^^^^^^^^^^^^^^^^^^^^ no `gobject_sys` in the root
error[E0432]: unresolved import `gio_sys`
--> src/lib.rs:12:5
|
12 | use gio_sys as gio;
| ^^^^^^^^^^^^^^ no `gio_sys` in the root
error[E0432]: unresolved import `atk_sys`
--> src/lib.rs:13:5
|
13 | use atk_sys as atk;
| ^^^^^^^^^^^^^^ no `atk_sys` in the root
error[E0432]: unresolved import `gdk_sys`
--> src/lib.rs:14:5
|
14 | use gdk_sys as gdk;
| ^^^^^^^^^^^^^^ no `gdk_sys` in the root
error[E0432]: unresolved import `pango_sys`
--> src/lib.rs:15:5
|
15 | use pango_sys as pango;
| ^^^^^^^^^^^^^^^^^^ no `pango_sys` in the root
error[E0432]: unresolved import `libc`
--> src/lib.rs:18:5
|
18 | use libc::{c_int, c_char, c_uchar, c_float, c_uint, c_double,
| ^^^^ maybe a missing crate `libc`?
Hello. I am trying to implement a grid with two columns containing image buttons. The columns are evenly distributed and I have vertical scrolling enabled. I want to load images into the buttons dynamically such that they are scaled to use the available width and the height implied by this width and the image's aspect ratio. They also shall be resized when their environment does. I tried to use the size_allocate signal but this is kind of unlegit as I request a larger height when already allocating. It also does not work, the button only resizes delayed when it gets its next update by window resizing or similar. So I tried to create a custom sublass to somehow be able to customize height for width and similar functions. But it seems like buttons currently are not subclassable.
Does anyone have an idea on how to solve this problem? I am trying to do so for two days...
ToggleButton->Alignment->Box->Image
which seems to be generated by button.set_image
. Outputting the allocations of all those widgets reveals that Box
and Image
have a small allocation (14x11) while the other ones have a much larger one (e.g. 377x301 for the Alignment
). I set h/v expand and h/v align to true/Fill for the Box
. The Box
also just has a single child. I do not understand why the Box
does not use the size of the Alignment
. Furthermore, I have problems trying more things with the Alignment
because it seems like it is not part of the language binding (it was in previous versions).
I was able to fix the problem by not using set_image
. Now I directly use add
to add a child to the button as a button also is a container.
According to its functionality, gtk::Alignment
likely is what caused my problems here as it seems to ignore other expand attributes. While it is flagged as deprecated (or at least all its member functions are), it is still used when setting the image for a button (where it is configured not to expand its content). I think that the reason why it was removed from gtk-rs is that it is deprecated but I could not find any further information about when and why it was removed. In my opinion it should be readded or potential problems caused by it should be documented for e.g. set_image
as it is still being used by gtk3. Currently, it adds potentially unwanted behaviour while gtk-rs provides no interface to influence this behaviour.
add()
. But get_children()
does not return those widgets as foreach()
and forall()
are not overridden while they are in the C tutorial. But ContainerImpl
does not allow me to override this? How can I fix this? Is there some special way of adding children I did not find in the documentation?