gtk | DEPRECATED , use https

 by   gtk-rs Rust Version: 0.9.0 License: MIT

kandi X-RAY | gtk Summary

kandi X-RAY | gtk Summary

gtk is a Rust library. gtk has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

Project site | Online documentation. Rust bindings and wrappers for GLib, GDK 3, GTK+ 3 and Cairo.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              gtk has a medium active ecosystem.
              It has 1274 star(s) with 90 fork(s). There are 35 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 0 open issues and 410 have been closed. On average issues are closed in 483 days. There are 4 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of gtk is 0.9.0

            kandi-Quality Quality

              gtk has 0 bugs and 0 code smells.

            kandi-Security Security

              gtk has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              gtk code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              gtk is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              gtk releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of gtk
            Get all kandi verified functions for this library.

            gtk Key Features

            No Key Features are available at this moment for gtk.

            gtk Examples and Code Snippets

            No Code Snippets are available at this moment for gtk.

            Community Discussions

            QUESTION

            Rust GTK: Trigger ApplicationWindow/DrawingArea redraw on a timer?
            Asked 2022-Mar-28 at 18:48

            I'm sure there's an easy way to do this but I don't know what it is. I have a very basic gtk::{Application, ApplicationWindow, DrawingArea}; setup. I want the DrawingArea::connect_draw closure to be triggered repeatedly on a timer, so it updates according to some changing state. (It would also be cool if it could be actively triggered by other threads, but a timer is fine.)

            So far everything I've found that would work on a timer fails because it would mean moving the ApplicationWindow to another thread. (fails with NonNull cannot be shared between threads safely) What I have currently triggers redraw on generic events, so if I click my mouse on the window it will redraw, but not do so automatically.

            That code is below, but please show me how to make this work?

            ...

            ANSWER

            Answered 2022-Mar-28 at 18:48

            Okay, I eventually made it work, after stumbling onto gtk-rs: how to update view from another thread . The key is to stash window in a thread-local global (TBH I don't really understand what that means but it works), and then access it through a static function.

            I had to modify the linked answer a bit because of scope disagreements between my channel and my window. Eventually I just decided to deal with them separately.

            I strongly suspect this is not the right way to do this, but at least it runs.

            Source https://stackoverflow.com/questions/71648807

            QUESTION

            Gtk3 `set_fixed_height_from_font` does not produce cells of correct height
            Asked 2022-Mar-25 at 15:07

            I am trying to make a tree view in Gtk3 such that each row has the size of two rows of text. The following is a minimal working example:

            ...

            ANSWER

            Answered 2022-Mar-25 at 15:01

            set_fixed_height_form_font works in Gtk2, but behaves differently in Gtk3.

            My solution (in the OCaml interface, as originally posted), was to compute the height explicitly following cell_renderer_text.get_size:

            Source https://stackoverflow.com/questions/71566428

            QUESTION

            How do I make a media player control notification in Gtk?
            Asked 2022-Mar-09 at 21:39

            In Rhythmbox (GNOME's music player), when it's playing music, you can open the notifications panel and control the music playback from there. Here's a screenshot. The playback controls are bordered in orange; they have a little music note icon:

            This is what I want to make; the media playback controls. Note that, while it is in the notifications panel, it's not technically a notification, because it never pops up on the screen, and you can't make it go away. In the screenshot, you can see the actual notification, which I don't want to make, below the controls.

            I know that there's a Gio.Notification, but it's not quite what I need (unless I'm very much mistaken). I searched in Gio, Gdk, and Gtk, but I didn't find anything. I also searched, among other things, [gtk] media control and [gtk] media notification on Stack Overflow, but I didn't find anything there either.

            Thanks to the help of BobMorane, I've now figured out that Rhythmbox uses libnotify for its player controls. I know how to create actions using Notify.Notification, and I can make them have images, etc., but what I still haven't figured out is how to:

            1. Make the notification so that it can't be closed;
            2. Make it so that the action buttons are next to the icon and text, not under;
            3. Keep the notification on top of all the others in the notifications panel.

            Using Python's help() function to look at gi.repository.Notify.Notification, the only methods I see that seem to have potential are add_action() (particularly its user_data parameter) and set_hint() (and its variants). Could these be used to achieve my goal?

            How do I make a media-control "notification" in Gtk with Python, as explained above?

            ...

            ANSWER

            Answered 2022-Mar-09 at 21:22

            I think the technology used by Rhytmbox to acheive this is MPRIS (Media Player Remote Interfacing Specification). As they say on their we page:

            The Media Player Remote Interfacing Specification (MPRIS) is a standard D-Bus interface which aims to provide a common programmatic API for controlling media players.

            It provides a mechanism for discovery, querying and basic playback control of compliant media players, as well as a tracklist interface which is used to add context to the active media item.

            In Rhythmbox, this is implemented as a core plug-in. The code is pretty complicated, but basically implements the MPRIS specification. This implementation then exposes some information and controls out to other applications which want to control the Rhythmbox, like the Gnome Shell in your case. If you deactivate the MPRIS plug-in, the "notification player" will no longer work.

            In GNOME Shell, you can see they have their own MPRIS module as well (https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/mpris.js), which is used to:

            1. Respond to player notifications and display information (album art, title, buttons, etc).
            2. Send notifications to the player (ex.: pause the song).

            In this module, the formatting of the buttons and all that stuff comes into life as well. This means that on your part (the player's designer), you should have no UI formatting to do (you don't have control over this, GNOME Shell has). What you need to do is expose what is needed by the GNOME Shell by implementing the MPRIS interfaces.

            (As a side note: the calendar.js file is the one implementing the notification list, and you can see it uses MPRIS "notifications", which it puts on top of standard notifications.)

            There exist Python libraries to do so, such as Mopidy-MPRIS, bit their support for the GNOME Shell seems not to be working at the moment. You may have to look for D-Bus related libraries on FreeDesktop.org. There exists many bindings, with some in Python.

            I hope this points you in the right direction.

            Source https://stackoverflow.com/questions/71288860

            QUESTION

            How to attach a gtk4 PopoverMenu to a parent widget?
            Asked 2022-Feb-21 at 17:33

            This should be a no-brainer but I just can't seem to figure it out. If I build a Gtk.PopoverMenu:

            ...

            ANSWER

            Answered 2022-Feb-21 at 17:33

            To set the parent of the PopoverMenu, just use its set_parent() method to set the parent to any widget:

            Source https://stackoverflow.com/questions/71197738

            QUESTION

            Making a clickable box in GTK4
            Asked 2022-Jan-25 at 19:06

            How can I make a gtk4::Box clickable in gtk_rs?

            In GTK3 it seems that using an EventBox was the way to achieve this, however in GTK4:

            Stop using GtkEventBox

            GtkEventBox is no longer needed and has been removed.

            All widgets receive all events.

            https://docs.gtk.org/gtk4/migrating-3to4.html#stop-using-gtkeventbox

            So it seems that click handlers should now be attached to widgets directly. However I can't find any clear documentation or examples on how to do this.

            If someone could give me an example of attaching a click listener to a gtk4::Box it would be much appreciated.

            ...

            ANSWER

            Answered 2022-Jan-25 at 19:06

            You can do this using gtk::GestureClick like shown in this example.

            Here is a full example (click somewhere inside the window as the box is not actually visible):

            Source https://stackoverflow.com/questions/69891299

            QUESTION

            i write a code for calculator in gtk3 c the code is total numbers, in i write 1+1+1+1 the result is 3+1 i want to fix to 4
            Asked 2022-Jan-21 at 18:03

            i write a code for calculator in gtk3 c the code is total numbers, in i write 1+1+1+1 the result is 3+1 i want to fix to 4 calcul result

            in i write sprintf(result,"%d%s",temp,rest); the result for 1+1+1+1 is 3+1 i want to result 4 i check for sprintf(result,"%d",temp); is not correct.

            the code of application :

            ...

            ANSWER

            Answered 2022-Jan-21 at 18:03

            First of all, if you remove all the unrelated code from your example, we get this MCVE:

            Source https://stackoverflow.com/questions/70803906

            QUESTION

            Show password button on entry in gtk
            Asked 2022-Jan-08 at 20:02

            Is there a way in gtk to make an eye icon on the right of an entry to show a password? I know there is a way to make a checkbox under an entry to show the password, but I want the button to be inside the entry, not outside. To put it simply:

            What i'm looking for is this: show password icon

            ...and not this: show password checkbox

            (I'm sorry that I cant embed the image. The site says I need 10 reputation first. I actually used to have almost 300 untill I got banned from a dislike attack. Please think before you dislike because it literally only takes ~20 to permenantly ban a year-long user. If anyone has enough reputation to edit the question and add the images in, please do)

            ...

            ANSWER

            Answered 2022-Jan-08 at 20:02

            You can put an icon to Gtk.Entry with the set_icon_from_ functions, for example set_icon_from_name.

            So you need to set the icon to for example to the view-reveal-symbolic.symbolic icon, make it clickable with set_icon_activatable and then in the signal handler for the icon-press event you need to set_visibility to either hide or show the text (and also change the icon to something like view-conceal-symbolic.symbolic).

            So the Gtk.Entry code could look like this

            Source https://stackoverflow.com/questions/70611691

            QUESTION

            GTKMM - Error drawing image for some widths
            Asked 2022-Jan-07 at 11:30

            I'm trying to draw on a window with Gtkmm for C++, cairo::context, gdk::pixbuf. I've noticed that for some widths (in my example 298), instead of my image, I get some horizontal black lines (alternated with white stripes).

            For other widths (in my example 300) I get a normal image. (I'm just drawing a yellow background in my example).

            What am I doing wrong ? How can I obtain to draw correctly for any image width ?

            I'm finding this behavior both on :

            windows 10 / msys2 / gcc11.2 / std=c++20

            opensuse 15.2 / gcc 11.2.1 / std=c++17

            and on both I have library versions:

            -I/usr/include/gtkmm-3.0 -L/usr/lib64 -I/usr/lib64/glibmm-2.4/include -I/usr/include/glibmm-2.4 -I/usr/lib64/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/include/sigc++-2.0/ -I/usr/lib64/sigc++-2.0/include -I/usr/include/giomm-2.4 -I/usr/lib64/giomm-2.4/include -I/usr/include/gdkmm-3.0 -I/usr/lib64/gdkmm-3.0/include -I/usr/lib64/pangomm-1.4/include -I/usr/include/gtk-3.0/ -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairomm-1.0 -I/usr/include/cairomm-1.0/cairomm -I/usr/lib64/cairomm-1.0/include -I/usr/include/freetype2 -I/usr/lib64/gtkmm-3.0/include -I/usr/include/pangomm-1.4 -I/usr/include/harfbuzz -I/usr/include/atkmm-1.6 -I/usr/include/atk-1.0 -I/usr/lib64/atkmm-1.6/include -LC:/programs/msys64/mingw64/bin -lgtkmm-3.0 -lglibmm-2.4 -I/usr/include/sigc++-2.0 -lsigc-2.0 -lgdkmm-3.0 -latkmm-1.6 -lcairomm-1.0

            Here's my code:

            ...

            ANSWER

            Answered 2022-Jan-07 at 11:30

            I'm used to the fact that image rows are often (not always) stored with a certain alignment. Whenever I see an image that appears erroneously in stripes, the row alignment is the first thing I would check.

            With this suspicion in mind, I look for some gdkmm (or Gdk) doc. Instead I found a comment in the Gdk source code.

            GitHub: gdk-pixbuf.c:

            Source https://stackoverflow.com/questions/70619527

            QUESTION

            module-info.java for SWT cross-platform maven project
            Asked 2021-Dec-16 at 18:27

            On Windows package org.eclipse.swt.win32.win32.x86_64 is used, while for Linux build it's org.eclipse.swt.gtk.linux.x86_64.

            1. If nothing is specified in module-info.java, error message is java: package org.eclipse.swt does not exist

            2. If in module-info.java both are specified:

              ...

            ANSWER

            Answered 2021-Dec-16 at 18:27

            It's a bug 559162 in SWT. Their Automatic-Module-Name in the SWT jar files manifest is impractical.

            I suggest to stick to module-less builds (without module-info.java) until this gets fixed.

            Source https://stackoverflow.com/questions/69857594

            QUESTION

            gtksharp TextView.PopulatePopup works to add handlers to existing menu items, but doesn't work to add new menu items
            Asked 2021-Dec-10 at 16:25

            I am trying to add items to the context menu of a TextView in GtkSharp (version 3.22.25.128). The context menu normally has the entries Cut/Copy/Paste/Delete/Separator/Select All/Insert Emoji. I am trying to add several more entries to the menu, starting with a separator.

            To do this I am adding a handler to the PopulateMenu event, like so:

            ...

            ANSWER

            Answered 2021-Dec-10 at 16:25

            In PopulatePopup, you must set the Visible flag of items you are adding to "true" to get them to appear as expected.

            This handler works as expected:

            Source https://stackoverflow.com/questions/70253293

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install gtk

            You can download it from GitHub.
            Rust is installed and managed by the rustup tool. Rust has a 6-week rapid release process and supports a great number of platforms, so there are many builds of Rust available at any time. Please refer rust-lang.org for more information.

            Support

            The majority of the documentation is kept in a separate repo due to licensing issues. You can pull it in with cargo:. Changes to those doc-comments should be submitted to the lgpl-docs repo. Avoid including those embedded doc-comments in PRs to this repo.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/gtk-rs/gtk.git

          • CLI

            gh repo clone gtk-rs/gtk

          • sshUrl

            git@github.com:gtk-rs/gtk.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link