display.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:ECoG-ClusterFlow 作者: sugeerth 项目源码 文件源码
def show(self):
        """Opens a GTK window and puts the heatmap in it.  Intelligent enough to work with the GUI as well."""

        window_only = 1 #What needs to be destroyed when the window is destroyed?

        if HMAP_ENABLED and DISPLAY_ENABLED:

            def destroy():

                if window_only:
                    window.destroy()
                else:
                    gtk.main_quit()

            gtk.gdk.threads_enter()
            window = gtk.Window()
            window.set_title("Showing heatmap...")
            window.set_border_width(10)
            window.set_resizable(False)
            window.connect("delete_event", lambda w, e: destroy())

            backbone = gtk.HBox(True)
            image = gtk.Image()
            image.set_from_pixbuf(self._image_to_pixbuf(self.im))
            backbone.pack_start(image)

            window.add(backbone)
            window.show_all()
            gtk.gdk.threads_leave()

            if gtk.main_level() == 0:
                window_only = 0
                gtk.main()

        else:
            raise "HmapError", "Error loading modules or unable to display"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号