Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Gtk;
- public const string[] label_text = {"Cool!", "Awesome!"};
- public int label_text_iter = 0;
- public Label label;
- public void swap_label()
- {
- label_text_iter++;
- if (label_text_iter > 1)
- {
- label_text_iter = 0;
- }
- label.set_text(label_text[label_text_iter]);
- }
- public static int main(string[] args)
- {
- Gtk.init(ref args);
- var window = new Window();
- var hbox = new Box (Orientation.VERTICAL, 2);
- var button = new Button();
- label = new Label(label_text[label_text_iter]);
- button.set_label("Great!");
- hbox.add(label);
- hbox.add(button);
- window.add(hbox);
- window.title = "My first GTK program";
- window.set_default_size (350, 70);
- window.show_all();
- window.destroy.connect (Gtk.main_quit);
- button.clicked.connect(swap_label);
- Gtk.main();
- return 0;
- }
Add Comment
Please, Sign In to add comment