gtk-rs / gtk

DEPRECATED, use https://github.com/gtk-rs/gtk3-rs repository instead!
https://gtk-rs.org/
MIT License
1.24k stars 82 forks source link

Documentation: Suggested update to example on gtk-rs.org front page #977

Closed ndearns closed 4 years ago

ndearns commented 4 years ago

I added gtk and gio to my toml file and tried to compile the standard cargo new hello world program, but this gave me a slew of errors in the build process, missing atk, pango, etc.

These were all resolved when I ran:

sudo apt-get install libgtk-3-dev

Can I suggest that this is added to gtk-rs.org home page? I nearly gave up on trying to use the gtk package because of that stumbling block, and I imagine that many people do. Telling them how to install all the missing dependencies might encourage more of them to stick with it.

GuillaumeGomez commented 4 years ago

You mean like https://gtk-rs.org/#using (which is the home of gtk-rs.org)?

ndearns commented 4 years ago

Yes, that's the page.

I'm trying to work through the tutorials. It is very difficult.

Can I suggest a golden rule for tutorial examples?

All tutorial examples should be complete and executable

I'm newish to rust and have never used gtk before. I'm finding that the tutorial snippets do not work.

For example, when I try the casting example for Widgets I get this:

Compiling gtk_play v0.1.0 (/home/neilearnshaw/rust/gtk_play) error[E0432]: unresolved import gtk::Object --> src/main.rs:8:11 | 8 | use gtk::{Object, Box, Application, ApplicationWindow, Button}; | ^^^^^^ no Object in the root

error[E0412]: cannot find type Object in crate gtk --> src/main.rs:44:21 44 fn is_a<W: IsA + IsA + Clone, ^^^^^^ not found in gtk

help: there is an enum variant gio::FileAttributeType::Object; try using the variant's enum | 44 | fn is_a<W: IsA + IsA + Clone, | ^^^^^^^^^^^^^^^^^^^^^^

error[E0412]: cannot find type Object in crate gtk --> src/main.rs:45:21 |

etc.

I would guess that you are very experienced with rust/gtk, but for people who aren't... it's things like this that make you want to go back to languages/guis that you know work. : (

GuillaumeGomez commented 4 years ago

Just with rust. For gtk, I mainly refer to the C documentation. If we added full examples every time, it'd be just too big...

ndearns commented 4 years ago

Ha, ha, the 'rust' example in this page (https://gtk-rs.org/docs/gtk/struct.ApplicationWindow.html) is written in C:

image

ndearns commented 4 years ago

Hmm, after three weeks of trying to get a working rust/gui combination together, I'm giving up. I'll come back in five years to see if rust is ready for real-world use. Thanks for your help, Guillamme and, Good Luck!

GuillaumeGomez commented 4 years ago

Oh that's a shame... Did you look at the examples?