示例#1
0
    def __init__(self):
        wx.Dialog.__init__(self, None, -1, "Mini Excel")
        sizer = wx.BoxSizer(wx.VERTICAL)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        hsizer.Add(wx.StaticText(self, -1, "Value:"), 0,
                   wx.ALIGN_CENTER_VERTICAL)
        self.cell_value = wx.TextCtrl(self, -1)
        hsizer.Add(self.cell_value, 1, wx.EXPAND)
        b = wx.Button(self, -1, "&Set")
        self.Bind(wx.EVT_BUTTON, self.OnSetCell, b)
        hsizer.Add(b)
        sizer.Add(hsizer, 0, wx.EXPAND)

        grid = Grid(self)
        grid.SetTable(Table())
        grid.ForceRefresh()
        self.grid = grid

        self.Bind(EVT_GRID_CELL_LEFT_CLICK, self.OnCellClick, grid)
        self.current_cell = (0, 0)

        sizer.Add(grid, 1, wx.EXPAND)
        self.SetSizer(sizer)
        sizer.Fit(self)
        grid.SetFocus()

        self.CenterOnScreen()
示例#2
0
文件: wistool.py 项目: peicer/wistool
    def createchannelwin(self,chn):
        newspwin=wx.SplitterWindow(self.channelwin,wx.ID_ANY,style=wx.SP_3DBORDER|wx.SP_3DSASH|wx.NO_BORDER)
        xgrid=Grid(newspwin,wx.ID_ANY,style=wx.SUNKEN_BORDER)
        xgrid.SetRowLabelSize(0)
        xtable=CustomDataTable()
        xtable.colLabels=['深度',chn]
        xx,yy=self.wish.readchannel(chn)
        self.actch_data=(xx,yy)
        xtable.data=list(zip(xx[:500],yy[:500]))
        xgrid.SetTable(xtable,True)
        xgrid.ForceRefresh()
        
        
        xpan=wx.Panel(newspwin,wx.ID_ANY,style=wx.SUNKEN_BORDER)
        self.toolb.SetToolShortHelp(200,u'保存曲线数据['+chn+']')
        mpl=PlotExample(xpan,(400,4000))
        mpl.plot(yy, xx)
#         mpl.Show()
        
#         MPL=MPL_Panel_base(xpan,(400,4000))
#         
#         #MPL.Figure.set_figheight(20)
#         #MPL.set_psize(500, 3000)
#         #MPL.xticker(10.0,2.0)
        BoxSizer=wx.BoxSizer(wx.VERTICAL) 
        BoxSizer.Add(mpl,proportion =1, border = 1,flag = wx.ALL|wx.EXPAND)
        xpan.SetSizer(BoxSizer)
        xpan.Fit()
#         MPL.cla()
#         MPL.plot(yy,xx,'red')
#         MPL.yticker(50.0, 25.0)
#         MPL.xticker(10, 5)
#         MPL.xlim(50,150)
#         MPL.ylim(4000, 1000)
#         MPL.grid()
#         dd=MPL.pl.gca().xaxis
        #dd.set_label_position('top')
#         MPL.UpdatePlot()

        #MPL.Update()
        #wx.StaticText(xpan, -1, chn, (5,5))
        
        newspwin.SetMinimumPaneSize(20)
        newspwin.SplitVertically(xgrid, xpan, 180)
        old=self.channelwin.GetWindow2()
        self.channelwin.ReplaceWindow(old,newspwin)
        old.Destroy()
        newspwin.Show(True)