我希望能够在显示小部件后更改GtkButton的标签
char *ButtonStance == "Connect";
GtkWidget *EntryButton = gtk_button_new_with_label(ButtonStance);
gtk_box_pack_start(GTK_BOX(ButtonVbox), EntryButton, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(TopVbox), ButtonVbox, TRUE, TRUE, 0);
gtk_widget_show_all(TopVbox);
ButtonStance == "Disconnect";
gtk_button_set_label(GTK_BUTTON(EntryButton), ButtonStance);
gtk_main();
有谁知道怎么做?
答案 0 :(得分:6)
ptomato是对的,您正在使用==
,您应该使用=
您的代码应如下所示:
char *ButtonStance = "Connect";
GtkWidget *EntryButton = gtk_button_new_with_label(ButtonStance);
gtk_box_pack_start(GTK_BOX(ButtonVbox), EntryButton, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(TopVbox), ButtonVbox, TRUE, TRUE, 0);
gtk_widget_show_all(TopVbox);
ButtonStance = "Disconnect";
gtk_button_set_label(GTK_BUTTON(EntryButton), ButtonStance);
gtk_main();