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


Python FigureCanvasWxAgg._onSize方法代码示例

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


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

示例1: DisplayPanel

# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import _onSize [as 别名]
class DisplayPanel(wx.Frame):

    ENV = None
    def __init__(self, title, playerManager):
        super(DisplayPanel,self).__init__(None, title=title, size = (680,450))
        h = 450
        w = 500
        self.playerManager = playerManager
        main_sizer = wx.BoxSizer(wx.HORIZONTAL)
        vbox_disp = wx.BoxSizer(wx.VERTICAL)
        hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        hbox3 = wx.BoxSizer(wx.HORIZONTAL)
        self.main_panel = wx.Panel(self, -1)
        self.main_panel.SetBackgroundColour('#4f5049')

        self.dispPanel = wx.Panel(self.main_panel, -1,size=(380,450))
        """Begin Menu Bar"""
        menubar = wx.MenuBar()
        fileMenu = wx.Menu()
        fitem1    = fileMenu.Append(wx.ID_EXIT, 'Quit', 'Quit application')
        self.Bind(wx.EVT_MENU, self.OnQuit, fitem1)

        fitem2 = fileMenu.Append(wx.ID_SAVE, 'Save' ,'Save Network')
        self.Bind(wx.EVT_MENU, self.OnSave, fitem2)
        menubar.Append(fileMenu, '&File')

        self.SetMenuBar(menubar)
        """End Menu Bar"""



        self.msg = wx.TextCtrl(self.dispPanel,size=(w, h), style=wx.TE_MULTILINE)
        hbox1.Add(self.msg, proportion=0, flag=wx.EXPAND)

        self.nb = wx.Notebook(self.dispPanel)

        """Begin Tabs"""
        #Tab1
        self.tab1 = wx.Panel(self.nb)
        self.fig = Figure((5,4),75)
        self.axes = self.fig.add_subplot(111)
        self.canvas = FigureCanvasWxAgg(self.tab1, -1, self.fig)
        self.nb.AddPage(self.tab1,"Stream")

        #Tab2
        self.tab2 = wx.Panel(self.nb)
        t2 = wx.StaticText(self.tab2, label="Tensor Board Goes Here")
        self.nb.AddPage(self.tab2, "Network")
        """End Tabs"""

        hbox2.Add(self.nb, proportion=1, flag=wx.EXPAND| wx.BOTTOM)
        """
        self.ID_RANDOM = wx.NewId()
        b1 = wx.Button(self.main_panel, label='Random Plot', id=self.ID_RANDOM)
        hbox3.Add(b1, proportion = 0, flag = wx.EXPAND)
        self.Bind(wx.EVT_BUTTON, self.newPlot, id=self.ID_RANDOM)
        """
        vbox_disp.Add(hbox2, proportion=0, flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=0)
        vbox_disp.Add(hbox3, flag=wx.CENTER)
        vbox_disp.Add(hbox1, proportion=0, flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=0)

        self.dispPanel.SetSizer(vbox_disp)
        main_sizer.Add(self.dispPanel,1,wx.LEFT)
        self.contPanel = self.initControllPanel()
        main_sizer.Add(self.controll_panel,0,flag=wx.EXPAND|wx.RIGHT)

        self.main_panel.SetSizer(main_sizer)
        self.Move((200,0))
        self.Show()

    def  newPlot(self, e):
        eid = e.GetId()

        if(eid == self.ID_RANDOM):
            self.msg.AppendText('Generating Random Plot\n')
            self.plot_Data = np.random.randint(8000, size=(14, 14))
            self.axes.imshow(self.plot_Data, interpolation='nearest')
            self.canvas._onSize(1)


    def OnQuit(self, e):
        self.Close()

    def OnSave(self, e):

        SaveDialog.playerManager = self.playerManager
        save = SaveDialog(None,title='Save Neural Network')
        save.ShowModal()
        #print('Saving Disabled')
        save.Destroy()

    def OnPlayerChange(self,e):
        self.sc_player.SetRange(1,self.playerManager.playerCount)
        print(self.sc_player.GetValue() - 1, type(self.sc_player.GetValue()))
        self.playerManager.silent_Change( self.sc_player.GetValue() - 1)

    def OnBounceScroll(self,e):
        CollisionMonitor.restitution = self.bounce_slider.GetValue()/100

#.........这里部分代码省略.........
开发者ID:cheech36,项目名称:CollidingSpheres,代码行数:103,代码来源:GUI.py


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