当前位置: 首页>>代码示例>>Python>>正文


Python FigureCanvasGTK3Cairo.draw_idle方法代码示例

本文整理汇总了Python中matplotlib.backends.backend_gtk3cairo.FigureCanvasGTK3Cairo.draw_idle方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasGTK3Cairo.draw_idle方法的具体用法?Python FigureCanvasGTK3Cairo.draw_idle怎么用?Python FigureCanvasGTK3Cairo.draw_idle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.backends.backend_gtk3cairo.FigureCanvasGTK3Cairo的用法示例。


在下文中一共展示了FigureCanvasGTK3Cairo.draw_idle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Calculator

# 需要导入模块: from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo [as 别名]
# 或者: from matplotlib.backends.backend_gtk3cairo.FigureCanvasGTK3Cairo import draw_idle [as 别名]

#.........这里部分代码省略.........
            else:
                y_lim.append(num2)
                y_lim.append(num1)
        
        self.x = []
        self.y = []
        self.x = arange(from_x,to_x,0.01)

        for x in self.x:
            try:
                string = text.split(",")[0].replace("x",str("(%f)"%(x)))
                tmp_number = solve_expresion(string)

                if ( type(tmp_number) != str ):
                    self.y.append(tmp_number)
                else:
                    self.y.append(None)
                    continue
            except TypeError:
                self.y.append(None)
            except Exception as e:
                print(e)
                self.builder.get_object("plot_1").set_text("Invalid synatax, use variable x")
        self.y = array(self.y)
        print(len(self.x))
        print(len(self.y))
        self.ax.plot(self.x,self.y)

        self.ax.set_xlim(from_x,to_x)
        if ( len(y_lim) == 2 ):
            print("ase")
            self.ax.set_ylim(y_lim[0],y_lim[1])
        self.ax.grid(True)
        self.canvas.draw_idle()
        # c == None podminka
        # c = re.match("(from=[-+]?(\d{1,}) to=[-+]?(\d{1,}))|(to=[-+]?(\d{1,}) from=[-+]?(\d{1,}))"
        #group(0) = founded string
        #group(1) = fouund first variante
        #group(2) = number from
        #group(3) = number to
        #group(4) = found second variante
        #group(5) = number to
        #group(6) = number from






    def back_to_future(self,w,data=None):
        if ( w.get_label() != "" ):
            self.text_buff.set_text(w.get_label())
            self.builder.get_object("notebook1").set_current_page(self.hisotry_page[self.history_ex.index(w.get_label())])  

    def add_to_history(self,expresion,page):
        if ( expresion in self.history_ex):
            return
        if ( len(self.history_ex) == 10 ):
            del(self.history_ex[0])
            del(self.hisotry_page[0])
            self.history_ex.append(expresion)
            self.hisotry_page.append(page)
        else:
            self.history_ex.append(expresion)
            self.hisotry_page.append(page)
开发者ID:barvirm,项目名称:The-Calculator-v2.0,代码行数:69,代码来源:main.py

示例2: __init__

# 需要导入模块: from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo [as 别名]
# 或者: from matplotlib.backends.backend_gtk3cairo.FigureCanvasGTK3Cairo import draw_idle [as 别名]

#.........这里部分代码省略.........
        else:
            value_str = "{0:.{1}f}".format(value, self.digits).rstrip("0")
        
        entry.set_text(value_str)
        
        
    def get_entry_value(self, entry, dtype):
        
        text = entry.get_text()
        try:
            val = float(text)
            if dtype == int:
                val = int(val)
        except ValueError:
            val = None
        
        return val


    def on_button_save_clicked(self, widget):
        pass       
        
    
    def on_cmapcombo_changed(self, widget):     
        
        tree_iter = widget.get_active_iter()
        if tree_iter != None:
            model = widget.get_model()
            name, image = model[tree_iter]
            
            self.cmap = name
            if hasattr(self, 'fig'):
                self.display_image()
                self.canvas.draw_idle()
       
        
    def on_namecombo_changed(self, widget):
        
        text = widget.get_active_text()
        print(text)
        if text == 'Mandelbrot':
            self.x = 0
            self.y = 0
            self.set_entry_value(self.entries['x'])
            self.set_entry_value(self.entries['y'])
        
        if hasattr(self, 'fig'):
            self.update_image()
        
        
    def on_button_apply_clicked(self, widget):  
    
        self.update_image()
        
    def on_button_reset_clicked(self, widget):  
        
        for name, entry in self.entries.items():
            setattr(self, name, getattr(self, name + "_default"))
            self.set_entry_value(entry)
    
    
    
    def on_canvas_button_release(self, widget, event):
    
        mapping = {1: 0.75, 3: 1.5}
        if event.button in mapping:
开发者ID:TarasKuzyo,项目名称:python-fractals,代码行数:70,代码来源:julia-fractal.py


注:本文中的matplotlib.backends.backend_gtk3cairo.FigureCanvasGTK3Cairo.draw_idle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。