我可以将图像文件加载到“GTk-glad”中吗?工具作为GUI框架来工作吗?

发布于 2024-10-28 12:50:51 字数 297 浏览 2 评论 0原文

我知道“GtK-glade”有很多方便的示例GUI框架,如管理UI,有很多示例使用Glade内部工具的模板,如按钮、菜单、标签。

但我想使用我自己的 GUI 框架来为用户定制。而且我只是找不到从“Glade”工具加载我自己的框架“图像”的方法。

通过什么方法可以让我的一张“图像”框架来代替“Glade”工具的样本框架?

或者通过什么样的“GtK”类似林间空地的工具可以完成这项工作?

我使用Ubuntu linux的c源代码。而且我找不到工具包来更新我原来的 GUI 源代码。我只发现GTK-glade可以打开它。

I know that "GtK-glade" got many convinent sample GUI frame like Management UI, there are many samples using the template of Glade's inside tool, like buttons, menus, label.

But I had like to use my own frame of GUI to be costumerized for users.And I just can't find a way to load my own "image" of frame from the "Glade" tool.

By What method can I let my one "image" of frame to replace the sample frame of "Glade" tool?

Or by what kind of "GtK" glade-like tooling can do this job?

I use c souce code of Ubuntu linux. And I can't find an toolkit to update my original souce code of GUI. I only find that GTK-glade can open it .

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

财迷小姐 2024-11-04 12:50:51
int
main (int argc, char *argv[])

..........

 GtkImage        *image = NULL;

 image = glade_xml_get_widget (gxml, "image1");

 gtk_image_set_from_file(image,"tux.png");

我的林间空地 xml 文件是:

    <?xml version="1.0"?>
<glade-interface>
  <!-- interface-requires gtk+ 2.6 -->
  <!-- interface-naming-policy toplevel-contextual -->
  <widget class="GtkWindow" id="window1">
    <property name="visible">True</property>
    <property name="border_width">10</property>
    <property name="title" translatable="yes">window1</property>
    <property name="default_width">800</property>
    <property name="default_height">480</property>
    <signal name="destroy" handler="on_window1_destroy"/>
    <child>
      <widget class="GtkVBox" id="vbox2">
        <property name="visible">True</property>
        <property name="spacing">2</property>
        <child>
          <widget class="GtkEntry" id="entry1">
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="invisible_char">â</property>
          </widget>
          <packing>
            <property name="expand">False</property>
            <property name="fill">False</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <widget class="GtkButton" id="button1">
            <property name="label" translatable="yes">Hello</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">False</property>
            <property name="use_underline">True</property>
            <signal name="clicked" handler="on_button1_clicked"/>
          </widget>
          <packing>
            <property name="expand">False</property>
            <property name="fill">False</property>
            <property name="position">1</property>
          </packing>
        </child>
        <child>
          <widget class="GtkLabel" id="label1">
            <property name="visible">True</property>
            <property name="label" translatable="yes">label</property>
          </widget>
          <packing>
            <property name="position">2</property>
          </packing>
        </child>
        <child>
          <widget class="GtkImage" id="image1">
            <property name="visible">True</property>
            <property name="stock">gtk-missing-image</property>
          </widget>
          <packing>
            <property name="position">3</property>
          </packing>
        </child>
      </widget>
    </child>
  </widget>
</glade-interface>
int
main (int argc, char *argv[])

..........

 GtkImage        *image = NULL;

 image = glade_xml_get_widget (gxml, "image1");

 gtk_image_set_from_file(image,"tux.png");

my glade xml file is:

    <?xml version="1.0"?>
<glade-interface>
  <!-- interface-requires gtk+ 2.6 -->
  <!-- interface-naming-policy toplevel-contextual -->
  <widget class="GtkWindow" id="window1">
    <property name="visible">True</property>
    <property name="border_width">10</property>
    <property name="title" translatable="yes">window1</property>
    <property name="default_width">800</property>
    <property name="default_height">480</property>
    <signal name="destroy" handler="on_window1_destroy"/>
    <child>
      <widget class="GtkVBox" id="vbox2">
        <property name="visible">True</property>
        <property name="spacing">2</property>
        <child>
          <widget class="GtkEntry" id="entry1">
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="invisible_char">â</property>
          </widget>
          <packing>
            <property name="expand">False</property>
            <property name="fill">False</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <widget class="GtkButton" id="button1">
            <property name="label" translatable="yes">Hello</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">False</property>
            <property name="use_underline">True</property>
            <signal name="clicked" handler="on_button1_clicked"/>
          </widget>
          <packing>
            <property name="expand">False</property>
            <property name="fill">False</property>
            <property name="position">1</property>
          </packing>
        </child>
        <child>
          <widget class="GtkLabel" id="label1">
            <property name="visible">True</property>
            <property name="label" translatable="yes">label</property>
          </widget>
          <packing>
            <property name="position">2</property>
          </packing>
        </child>
        <child>
          <widget class="GtkImage" id="image1">
            <property name="visible">True</property>
            <property name="stock">gtk-missing-image</property>
          </widget>
          <packing>
            <property name="position">3</property>
          </packing>
        </child>
      </widget>
    </child>
  </widget>
</glade-interface>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文