相关疑难解决方法(0)

如何使用python在没有按键事件的情况下在内部更新/重绘GTK小部件(GTKLabel)?

我在下面有一些代码试图更新GTK Label元素.我包括两个文件:ui文件和py文件.

UI文件:

<glade-interface>
  <widget class="GtkWindow" id="ApplicationFrame">
    <property name="width_request">320</property>
    <property name="height_request">240</property>
    <property name="visible">True</property>
    <property name="events">GDK_KEY_PRESS_MASK</property>
    <property name="title" translatable="yes">Simple</property>
    <property name="resizable">False</property>
    <property name="window_position">center-always</property>
    <property name="default_width">320</property>
    <property name="default_height">240</property>
    <property name="decorated">False</property>
    <property name="gravity">center</property>
    <child>
      <widget class="GtkFixed" id="layout">
        <property name="width_request">320</property>
        <property name="height_request">240</property>
        <property name="visible">True</property>
        <child>
          <widget class="GtkLabel" id="l1">
            <property name="width_request">320</property>
            <property name="height_request">40</property>
            <property name="visible">True</property>
            <property name="xalign">0</property>
            <property name="label" translatable="yes">l1</property>
          </widget>
          <packing>
            <property name="y">43</property>
          </packing>
        </child>
      </widget>
    </child>
  </widget>
</glade-interface>
Run Code Online (Sandbox Code Playgroud)

Python文件

import os
from time import sleep as wait
import gtk as gtk
import gtk.glade …
Run Code Online (Sandbox Code Playgroud)

python gtk pygtk

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

gtk ×1

pygtk ×1

python ×1