• <tfoot id='Ui4n3'></tfoot>
    <legend id='Ui4n3'><style id='Ui4n3'><dir id='Ui4n3'><q id='Ui4n3'></q></dir></style></legend>

          <bdo id='Ui4n3'></bdo><ul id='Ui4n3'></ul>

        <i id='Ui4n3'><tr id='Ui4n3'><dt id='Ui4n3'><q id='Ui4n3'><span id='Ui4n3'><b id='Ui4n3'><form id='Ui4n3'><ins id='Ui4n3'></ins><ul id='Ui4n3'></ul><sub id='Ui4n3'></sub></form><legend id='Ui4n3'></legend><bdo id='Ui4n3'><pre id='Ui4n3'><center id='Ui4n3'></center></pre></bdo></b><th id='Ui4n3'></th></span></q></dt></tr></i><div id='Ui4n3'><tfoot id='Ui4n3'></tfoot><dl id='Ui4n3'><fieldset id='Ui4n3'></fieldset></dl></div>
      1. <small id='Ui4n3'></small><noframes id='Ui4n3'>

      2. 动态更新 gtk.VBox

        update a gtk.VBox dynamically(动态更新 gtk.VBox)
      3. <tfoot id='lJ8PG'></tfoot>
          <legend id='lJ8PG'><style id='lJ8PG'><dir id='lJ8PG'><q id='lJ8PG'></q></dir></style></legend>

          <small id='lJ8PG'></small><noframes id='lJ8PG'>

            <bdo id='lJ8PG'></bdo><ul id='lJ8PG'></ul>

                <tbody id='lJ8PG'></tbody>
                • <i id='lJ8PG'><tr id='lJ8PG'><dt id='lJ8PG'><q id='lJ8PG'><span id='lJ8PG'><b id='lJ8PG'><form id='lJ8PG'><ins id='lJ8PG'></ins><ul id='lJ8PG'></ul><sub id='lJ8PG'></sub></form><legend id='lJ8PG'></legend><bdo id='lJ8PG'><pre id='lJ8PG'><center id='lJ8PG'></center></pre></bdo></b><th id='lJ8PG'></th></span></q></dt></tr></i><div id='lJ8PG'><tfoot id='lJ8PG'></tfoot><dl id='lJ8PG'><fieldset id='lJ8PG'></fieldset></dl></div>
                  本文介绍了动态更新 gtk.VBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我经常使用这个网站来解决我在使用 Python 编程时遇到的小问题.这一次,不知何故我找不到适合我情况的解决方案.所以,这是我的问题:

                  I have been using this website pretty often in order to solve small issues that I have while programming in Python. This time, somehow I could not find a suitable solution for my situation. So, here is my problem:

                  我想动态地将条目添加到 gtk.VBox 小部件.问题是它不能按照我想要的方式工作.我只有一个按钮,它的作用是向 VBox 添加一个额外的小部件.不幸的是,小部件没有出现在窗口上.我想,我必须添加类似 repaint 函数调用的东西,但我没有找到类似的东西.这是一个示例代码,显示了我的问题:

                  I want to dynamically add entries to a gtk.VBox widget. The problem is that it doesn't work the way I want it to work. I simply have a button, whose action is to add an additional widget to a VBox. Unfortunately the widget doesn't appear on the window. I guess, I have to add something like a repaint function call, but I didn't find anything like that. Here is a sample code, showing my problem:

                  import gtk
                  
                  class DynamicVbox:
                  
                      def __init__(self):
                          self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
                          self.window.connect("destroy", self.close_application)
                          self.window.set_size_request(400,320)
                          #a hBox to put the button and the dynamic vBox
                          hBox = gtk.HBox(False, 0)
                  
                          addButton = gtk.Button("add checkbox")
                          addButton.connect("clicked", self.AddCheckButton)
                  
                          self.vBox = gtk.VBox(False, 0)
                          self.vBox.pack_start(gtk.CheckButton("CheckButton"), True, True, 1)
                          hBox.pack_start(self.vBox, True, True, 5)
                          hBox.pack_end(addButton, False, False, 5)
                          self.window.add(hBox)
                  
                          #start gtk
                          self.window.show_all()
                          gtk.main()
                  
                      def AddCheckButton(self, button):
                          self.vBox.pack_start(gtk.CheckButton("CheckButton"), True, True, 1)
                          print "adding checkbox..."
                  
                      def close_application(self, widget):
                          gtk.main_quit()
                  
                   # run it
                  
                  a = DynamicVbox()
                  

                  感谢任何帮助.提前致谢.

                  A appreciate any help. Thanks in advance.

                  推荐答案

                  新的检查按钮在那里,但在你调用 show() 之前是不可见的:

                  The new check button is there, but not visible until you call show() on it:

                  def AddCheckButton(self, button):
                      button = gtk.CheckButton("CheckButton")
                      self.vBox.pack_start(button, True, True, 1)
                      button.show()
                      print "adding checkbox..."
                  

                  这篇关于动态更新 gtk.VBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What happens when you compare 2 pandas Series(当你比较 2 个 pandas 系列时会发生什么)
                  Quickly find differences between two large text files(快速查找两个大文本文件之间的差异)
                  Python - Compare 2 files and output differences(Python - 比较 2 个文件和输出差异)
                  Why do comparisions between very large float values fail in python?(为什么在 python 中非常大的浮点值之间的比较会失败?)
                  Dictionary merge by updating but not overwriting if value exists(字典通过更新合并,但如果值存在则不覆盖)
                  Find entries of one text file in another file in python(在python中的另一个文件中查找一个文本文件的条目)

                      <tbody id='84w93'></tbody>

                      <small id='84w93'></small><noframes id='84w93'>

                      • <bdo id='84w93'></bdo><ul id='84w93'></ul>

                          • <i id='84w93'><tr id='84w93'><dt id='84w93'><q id='84w93'><span id='84w93'><b id='84w93'><form id='84w93'><ins id='84w93'></ins><ul id='84w93'></ul><sub id='84w93'></sub></form><legend id='84w93'></legend><bdo id='84w93'><pre id='84w93'><center id='84w93'></center></pre></bdo></b><th id='84w93'></th></span></q></dt></tr></i><div id='84w93'><tfoot id='84w93'></tfoot><dl id='84w93'><fieldset id='84w93'></fieldset></dl></div>
                            <legend id='84w93'><style id='84w93'><dir id='84w93'><q id='84w93'></q></dir></style></legend>

                            <tfoot id='84w93'></tfoot>