You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use gtk4 as gtk;use gtk::prelude::*;use gtk::{glib,Application,ApplicationWindow,Button,Box,Fixed};fnmain() -> glib::ExitCode{let app = Application::builder().application_id("app").build();
app.connect_activate(|app|
{// We create the main window.let window = ApplicationWindow::builder().application(app).default_width(1920/2).default_height(720).title("Hello, World!").build();// Create a vertical box container.let vbox = Fixed::new();// Create a button with text.let button = Button::with_label("+");// Text on the buttonconstBUTTON_SIZE:i32 = 20;
button.set_size_request(BUTTON_SIZE,BUTTON_SIZE);// Connect the button's clicked signal to a callback function.
button.connect_clicked(|_|
{on_button_click();});
vbox.put(&button,10.0,10.0);// Add the button to the window.
window.set_child(Some(&vbox));// Show the window.
window.present();});
app.run()}fnon_button_click(){}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
using gtk4 gui library I have this code:
As you can see in these two lines:
The button size should be 20 by 20 which is a square, however this is how it looks like when running:
Any idea why this is happening and how to fix this?
Beta Was this translation helpful? Give feedback.
All reactions