Changeset 2172 for trunk/python
- Timestamp:
- 05/18/11 12:48:33 (14 years ago)
- Location:
- trunk/python
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/customgui_base.py
r2171 r2172 6 6 from asap import scantable 7 7 from asap._asap import stmath 8 from asap.utils import _n_bools, mask_not, mask_or 8 9 9 10 ###################################### … … 113 114 114 115 115 ### Calculate statistics of the selected area. 116 def _single_mask(self,event): 117 # Do not fire event when in zooming/panning mode 118 if not self.figmgr.toolbar.mode == '': 119 return 120 # When selected point is out of panels 121 if event.inaxes == None: 122 return 123 if event.button == 1: 124 baseinv=True 125 elif event.button == 3: 126 baseinv=False 127 else: 128 return 129 130 def _calc_stats(): 131 msk=mymask.get_mask() 132 statstr = ['max', 'min', 'mean', 'median', 'sum', 'stddev', 'rms'] 133 for stat in statstr: 134 mymask.scan.stats(stat=stat,mask=msk) 135 136 # Interactive mask definition 137 from asap.interactivemask import interactivemask 138 mymask = interactivemask(plotter=self.plotter,scan=self.plotter._data) 139 # Create initial mask 140 mymask.set_basemask(invert=baseinv) 141 # Inherit event 142 mymask.set_startevent(event) 143 # Set callback func 144 mymask.set_callback(_calc_stats) 145 # Selected mask 146 mymask.select_mask(once=True,showmask=False) 147 116 ### Notation 148 117 def _mod_note(self,event): 149 118 # Do not fire event when in zooming/panning mode … … 167 136 #print "No text picked" 168 137 return False 138 139 140 ### Purely plotter based statistics calculation of a selected area. 141 ### No access to scantable 142 def _single_mask(self,event): 143 # Do not fire event when in zooming/panning mode 144 if not self.figmgr.toolbar.mode == '': 145 return 146 # When selected point is out of panels 147 if event.inaxes == None: 148 return 149 if event.button == 1: 150 exclude=False 151 elif event.button == 3: 152 exclude=True 153 else: 154 return 155 156 self._thisregion = {'axes': event.inaxes,'xs': event.x, 157 'worldx': [event.xdata,event.xdata], 158 'invert': exclude} 159 self.xold = event.x 160 self.xdataold = event.xdata 161 162 self.plotter._plotter.register('button_press',None) 163 self.plotter._plotter.register('motion_notify', self._xspan_draw) 164 self.plotter._plotter.register('button_press', self._xspan_end) 165 166 def _xspan_draw(self,event): 167 if event.inaxes == self._thisregion['axes']: 168 xnow = event.x 169 self.xold = xnow 170 self.xdataold = event.xdata 171 else: 172 xnow = self.xold 173 try: self.lastspan 174 except AttributeError: pass 175 else: 176 if self.lastspan: self._remove_span(self.lastspan) 177 178 self.lastspan = self._draw_span(self._thisregion['axes'],self._thisregion['xs'],xnow,fill="") 179 del xnow 180 181 def _draw_span(self,axes,x0,x1,**kwargs): 182 pass 183 184 def _remove_span(self,span): 185 pass 186 187 @asaplog_post_dec 188 def _xspan_end(self,event): 189 if not self.figmgr.toolbar.mode == '': 190 return 191 #if event.button != 1: 192 # return 193 194 try: self.lastspan 195 except AttributeError: pass 196 else: 197 self._remove_span(self.lastspan) 198 del self.lastspan 199 if event.inaxes == self._thisregion['axes']: 200 xdataend = event.xdata 201 else: 202 xdataend = self.xdataold 203 204 self._thisregion['worldx'][1] = xdataend 205 # print statistics of spectra in subplot 206 self._subplot_stats(self._thisregion) 207 208 # release event 209 self.plotter._plotter.register('button_press',None) 210 self.plotter._plotter.register('motion_notify',None) 211 # Clear up region selection 212 self._thisregion = None 213 self.xdataold = None 214 self.xold = None 215 # finally recover region selection event 216 self.plotter._plotter.register('button_press',self._single_mask) 217 218 def _subplot_stats(self,selection): 219 #from numpy import ma, ndarray 220 import numpy 221 statstr = ['max', 'min', 'median', 'mean', 'sum', 'std'] #'rms'] 222 panelstr = selection['axes'].title.get_text() 223 ssep = "-"*70 224 asaplog.push(ssep) 225 asaplog.post() 226 for line in selection['axes'].lines: 227 label = panelstr + ", "+line.get_label() 228 x = line.get_xdata() 229 selmsk = self._create_flag_from_array(x,selection['worldx'],selection['invert']) 230 y = line.get_ydata() 231 if isinstance(y,numpy.ma.masked_array): 232 ydat = y.data 233 basemsk = y.mask 234 else: 235 ydat = y 236 basemsk = False 237 if not isinstance(basemsk, bool): 238 # should be ndarray 239 newmsk = mask_or(selmsk,basemsk) 240 elif basemsk: 241 # the whole original spectrum is flagged 242 newmsk = basemsk 243 else: 244 # no channel was flagged originally 245 newmsk = selmsk 246 mdata = numpy.ma.masked_array(ydat,mask=newmsk) 247 del x, y, ydat, basemsk, selmsk, newmsk 248 statval = {} 249 for stat in statstr: 250 statval[stat] = getattr(numpy,stat)(mdata) 251 self._print_stats(statval,statstr=statstr,label=label,\ 252 mask=selection['worldx'],\ 253 unmask=selection['invert']) 254 asaplog.push(ssep) 255 asaplog.post() 256 del mdata, statval 257 del ssep, panelstr 258 259 def _create_flag_from_array(self,x,masklist,invert): 260 # Return True for channels which should be EXCLUDED (flag) 261 if len(masklist) <= 1: 262 asaplog.push() 263 asaplog.post("masklist should be a list of 2 elements") 264 asaplog.push("ERROR") 265 n = len(x) 266 # Base mask: flag out all channels 267 mask = _n_bools(n, True) 268 minval = min(masklist[0:2]) 269 maxval = max(masklist[0:2]) 270 for i in range(n): 271 if minval <= x[i] <= maxval: 272 mask[i] = False 273 if invert: 274 mask = mask_not(mask) 275 return mask 276 277 @asaplog_post_dec 278 def _print_stats(self,stats,statstr=None,label="",mask=None,unmask=False): 279 if not isinstance(stats,dict) or len(stats) == 0: 280 asaplog.post() 281 asaplog.push("Invalid statistic value") 282 asaplog.post("ERROR") 283 maskstr = "Not available" 284 if mask: 285 masktype = "mask" 286 maskstr = str(mask) 287 if unmask: masktype = "unmask" 288 289 sout = label + ", " + masktype + " = " + maskstr + "\n" 290 statvals = [] 291 if not len(statstr): 292 statstr = stats.keys() 293 for key in statstr: 294 sout += key.ljust(10) 295 statvals.append(stats.pop(key)) 296 sout += "\n" 297 sout += ("%f "*len(statstr) % tuple(statvals)) 298 asaplog.push(sout) 299 del sout, maskstr, masktype, statvals, key, stats, statstr, mask, label 300 169 301 170 302 ### Page chages … … 255 387 del lastpanel,currpnum,prevpnum,start_ipanel 256 388 257 ### refresh the page counter258 389 ### refresh the page counter 259 390 def set_pagecounter(self,page): … … 710 841 try: self.lastspan 711 842 except AttributeError: pass 712 else: self._remove_span(self.lastspan) 843 else: 844 if self.lastspan: self._remove_span(self.lastspan) 713 845 714 846 #self.lastspan = self._draw_span(self._thisregion['axes'],self._thisregion['xs'],xnow,fill="#555555",stipple="gray50") … … 737 869 xdataend = event.xdata 738 870 else: 739 xdataend =self.xdataold871 xdataend = self.xdataold 740 872 741 873 self._thisregion['worldx'][1] = xdataend … … 750 882 self._selregions[srow] = [] 751 883 self._selregions[srow].append(lregion) 752 del lregion, pregion, xdataend , self.xold, self.xdataold884 del lregion, pregion, xdataend 753 885 sout = "selected region: "+str(self._thisregion['worldx'])+\ 754 886 "(@row "+str(self._getrownum(self._thisregion['axes']))+")" … … 761 893 self._thisregion = None 762 894 self.xdataold = None 895 self.xold = None 763 896 # finally recover region selection event 764 897 self.plotter._plotter.register('button_press',self._add_region) -
trunk/python/customgui_qt4agg.py
r2168 r2172 35 35 text='notation', 36 36 command=self.modify_note, 37 balloon=" Add note")37 balloon="add note on plot") 38 38 self.bNote.setCheckable(True) 39 39 … … 41 41 text='statistics', 42 42 command=self.stat_cal, 43 balloon=" Calculate statistics")43 balloon="calculate statistics") 44 44 self.bStat.setCheckable(True) 45 45 … … 60 60 text=' + ', 61 61 command=self.next_page, 62 addit=False) 62 addit=False, 63 balloon="plot next page") 63 64 loPage.addWidget(self.bNext) 64 65 self.bPrev = self._NewButton(master=frPage, 65 66 text=' - ', 66 command=self.prev_page,addit=False) 67 command=self.prev_page,addit=False, 68 balloon="plot previous page") 67 69 loPage.addWidget(self.bPrev) 68 70 frPage.setLayout(loPage) … … 106 108 # go back to spec mode 107 109 self.bStat.setChecked(False) 108 self.bStat.setToolTip(" Calculate statistics")110 self.bStat.setToolTip("calculate statistics") 109 111 self.spec_show() 110 112 return … … 113 115 self.bStat.setToolTip("Back to spec value mode") 114 116 self.bNote.setChecked(False) 117 self.bNote.setToolTip("add note on plot") 115 118 self.mode = 'stat' 116 119 self.notewin.close_widgets() … … 126 129 if self.mode == 'note': 127 130 self.bNote.setChecked(False) 128 self.bNote.setToolTip(" Add note")131 self.bNote.setToolTip("add note on plot") 129 132 self.mode = 'none' 130 133 self.spec_show() 131 134 return 132 135 self.bStat.setChecked(False) 136 self.bStat.setToolTip("calculate statistics") 133 137 self.bNote.setChecked(True) 134 138 self.bNote.setToolTip("Back to spec value mode") … … 187 191 self._p.register('button_release',None) 188 192 193 def _draw_span(self,axes,x0,x1,**kwargs): 194 height = self._p.figure.bbox.height 195 y1 = height - axes.bbox.y1 196 h = axes.bbox.height 197 w = abs(x1 - x0) 198 rect = [ int(val) for val in min(x0,x1), y1, w, h ] 199 self._p.canvas.drawRectangle( rect ) 200 # nothing is returned by drawRectangle 201 return None 202 203 def _remove_span(self,span): 204 # Nothing to do with remove. just refresh (call only for) 205 self.canvas.draw() 189 206 190 207 … … 513 530 ## Add CASA custom Flag toolbar ## 514 531 ########################################### 532 # class CustomFlagToolbarQT4Agg(CustomFlagToolbarCommon, qt.QtGui.QToolBar): 533 # def __init__(self,parent): 534 # from asap.asapplotter import asapplotter 535 # if not isinstance(parent,asapplotter): 536 # return False 537 # if not parent._plotter: 538 # return False 539 # self._p = parent._plotter 540 # self.figmgr = self._p.figmgr 541 # self.canvas = self.figmgr.canvas 542 # self.mode = '' 543 # self.button = True 544 # self.pagecount = None 545 # CustomFlagToolbarCommon.__init__(self,parent) 546 # self.notewin=NotationWindowQT4Agg(master=self.canvas) 547 # self._add_custom_toolbar() 548 549 # def _add_custom_toolbar(self): 550 # qt.QtGui.QToolBar.__init__(self,parent=self.figmgr.window) 551 # self.figmgr.window.addToolBar(qt.QtCore.Qt.BottomToolBarArea,self) 552 # # Tk.Frame.__init__(self,master=self.figmgr.window) 553 # self.bRegion = self._NewButton(master=self, 554 # text='region', 555 # command=self.select_region, 556 # balloon="select channel regions") 557 # self.bRegion.setCheckable(True) 558 559 # self.bPanel = self._NewButton(master=self, 560 # text='panel', 561 # command=self.select_panel, 562 # balloon="select subplots") 563 # self.bPanel.setCheckable(True) 564 565 # self.bClear = self._NewButton(master=self, 566 # text='clear', 567 # command=self.cancel_select, 568 # balloon="clear selections") 569 570 # self.bFlag = self._NewButton(master=self, 571 # text='flag', 572 # command=self.flag, 573 # balloon="flag selections") 574 575 # self.bUnflag = self._NewButton(master=self, 576 # text='unflag', 577 # command=self.unflag, 578 # balloon="unflag selections") 579 580 # self.bStat = self._NewButton(master=self, 581 # text='statistics', 582 # command=self.stat_cal, 583 # balloon="print statistics of selections") 584 585 # self.bNote = self._NewButton(master=self, 586 # text='notation', 587 # command=self.modify_note, 588 # balloon="add note on plot") 589 # self.bNote.setCheckable(True) 590 591 # # page change oparations 592 # frPage = qt.QtGui.QWidget(parent=self,flags=qt.QtCore.Qt.Tool) 593 # loPage = qt.QtGui.QHBoxLayout(self) 594 # loPage.addStretch(1) 595 # self.lPagetitle = qt.QtGui.QLabel('Page:',parent=frPage) 596 # self.lPagetitle.setMargin(5) 597 # loPage.addWidget(self.lPagetitle) 598 # self.pagecount = qt.QtGui.QLabel(parent=frPage) 599 # self.pagecount.setStyleSheet("background-color: white") 600 # self.pagecount.setMargin(3) 601 # self.pagecount.setText(' 1') 602 # loPage.addWidget(self.pagecount) 603 # # frPage = Tk.Frame(master=self,borderwidth=2,relief=Tk.GROOVE) 604 # # frPage.pack(ipadx=2,padx=10,side=Tk.RIGHT) 605 # # self.lPagetitle = Tk.Label(master=frPage,text='Page:',padx=5) 606 # # #width=8,anchor=Tk.E,padx=5) 607 # # self.lPagetitle.pack(side=Tk.LEFT) 608 # # self.pagecount = Tk.StringVar(master=frPage) 609 # # self.lPagecount = Tk.Label(master=frPage, 610 # # textvariable=self.pagecount, 611 # # padx=5,bg='white') 612 # # self.lPagecount.pack(side=Tk.LEFT,padx=3) 613 614 # self.bNext = self._NewButton(master=frPage, 615 # text='+', 616 # command=self.next_page, 617 # addit=False, 618 # balloon="plot next page") 619 # loPage.addWidget(self.bNext) 620 # self.bPrev = self._NewButton(master=frPage, 621 # text='-', 622 # command=self.prev_page, 623 # addit=False, 624 # balloon="plot previous page") 625 # loPage.addWidget(self.bPrev) 626 # frPage.setLayout(loPage) 627 # self.addWidget(frPage) 628 629 # # self.bNext=self._NewButton(master=frPage, 630 # # text=' + ', 631 # # #imagename="hand.ppm", 632 # # command=self.next_page) 633 # # self.bPrev=self._NewButton(master=frPage, 634 # # text=' - ', 635 # # command=self.prev_page) 636 637 # self.bQuit = self._NewButton(master=self, 638 # text='Quit', 639 # #imagename="stock_close.ppm", 640 # command=self.quit, 641 # balloon="Close window") 642 643 # # if os.uname()[0] != 'Darwin': 644 # # self.bPrev.config(padx=5) 645 # # self.bNext.config(padx=5) 646 647 # self.pagecount.setText(' '*4) 648 # # self.pack(side=Tk.BOTTOM,fill=Tk.BOTH) 649 # # self.pagecount.set(' '*4) 650 651 # self.disable_button() 652 # return 653 654 # def _NewButton(self, master, text, command, balloon=None,addit=True,imagename=None): 655 # # def _NewButton(self, master, text, command, side=Tk.LEFT,imagename=None): 656 # img = None 657 # if imagename: 658 # imagename = os.path.join(matplotlib.rcParams['datapath'], 'images', imagename) 659 # # img = Tk.PhotoImage(master=master, file=imagename) 660 661 # b = qt.QtGui.QPushButton(text,parent=master) 662 # if balloon: b.setToolTip(balloon) 663 # if addit: master.addWidget(b) 664 # master.connect(b,qt.QtCore.SIGNAL('clicked()'),command) 665 # # if os.uname()[0] == 'Darwin': 666 # # b = Tk.Button(master=master, text=text, image=img, 667 # # command=command) 668 # # if img: b.image = img 669 # # else: 670 # # b = Tk.Button(master=master, text=text, image=img, padx=2, pady=2, 671 # # command=command) 672 # # if img: b.image = img 673 # # b.pack(side=side) 674 # return b 675 676 # def show_pagenum(self,pagenum,formatstr): 677 # self.pagecount.setText(formatstr % (pagenum)) 678 # # self.pagecount.set(formatstr % (pagenum)) 679 680 # def spec_show(self): 681 # if not self.figmgr.toolbar.mode == '' or not self.button: return 682 # self.figmgr.toolbar.set_message('spec value: drag on a spec') 683 # if self.mode == 'spec': return 684 # self.mode = 'spec' 685 # self.notewin.close_widgets() 686 # self.__disconnect_event() 687 # self._p.register('button_press',self._select_spectrum) 688 689 # def modify_note(self): 690 # if not self.figmgr.toolbar.mode == '': 691 # # Get back button status BEFORE clicked 692 # self.bNote.setChecked(not self.bNote.isChecked()) 693 # return 694 # self.figmgr.toolbar.set_message('text: select a position/text') 695 # if self.mode == 'note': 696 # self.bNote.setChecked(False) 697 # self.bNote.setToolTip("add note on plot") 698 # # self.bNote.config(relief='raised') 699 # self.mode = 'none' 700 # self.spec_show() 701 # return 702 # self.bNote.setChecked(True) 703 # self.bNote.setToolTip("Back to spec value mode") 704 # self.bRegion.setChecked(False) 705 # self.bRegion.setToolTip("select channel regions") 706 # self.bPanel.setChecked(False) 707 # self.bPanel.setToolTip("select subplots") 708 # # self.bNote.config(relief='sunken') 709 # # self.bRegion.config(relief='raised') 710 # # self.bPanel.config(relief='raised') 711 # self.mode = 'note' 712 # self.__disconnect_event() 713 # self._p.register('button_press',self._mod_note) 714 715 # def select_region(self): 716 # if not self.figmgr.toolbar.mode == '' or not self.button: 717 # # Get back button status BEFORE clicked 718 # self.bRegion.setChecked(not self.bRegion.isChecked()) 719 # self.figmgr.toolbar.set_message('select regions: click at start and end channels') 720 # if self.mode == 'region': 721 # self.bRegion.setChecked(False) 722 # self.bRegion.setToolTip("select channel regions") 723 # # self.bRegion.config(relief='raised') 724 # self.mode = 'none' 725 # self.spec_show() 726 # return 727 # self.bNote.setChecked(False) 728 # self.bNote.setToolTip("add note on plot") 729 # self.bRegion.setChecked(True) 730 # self.bRegion.setToolTip("Back to spec value mode") 731 # self.bPanel.setChecked(False) 732 # self.bPanel.setToolTip("select subplots") 733 # # self.bNote.config(relief='raised') 734 # # self.bRegion.config(relief='sunken') 735 # # self.bPanel.config(relief='raised') 736 # self.mode = 'region' 737 # self.notewin.close_widgets() 738 # self.__disconnect_event() 739 # self._p.register('button_press',self._add_region) 740 741 # def select_panel(self): 742 # if not self.figmgr.toolbar.mode == '' or not self.button: 743 # # Get back button status BEFORE clicked 744 # self.bPanel.setChecked(not self.bPanel.isChecked()) 745 # return 746 # self.figmgr.toolbar.set_message('select spectra: click on subplots') 747 # if self.mode == 'panel': 748 # self.bPanel.setChecked(False) 749 # self.bPanel.setToolTip("select subplots") 750 # # self.bPanel.config(relief='raised') 751 # self.mode = 'none' 752 # self.spec_show() 753 # return 754 # self.bNote.setChecked(False) 755 # self.bNote.setToolTip("add note on plot") 756 # self.bRegion.setChecked(False) 757 # self.bRegion.setToolTip("select channel regions") 758 # self.bPanel.setChecked(True) 759 # self.bPanel.setToolTip("Back to spec value mode") 760 # # self.bNote.config(relief='raised') 761 # # self.bRegion.config(relief='raised') 762 # # self.bPanel.config(relief='sunken') 763 # self.mode = 'panel' 764 # self.notewin.close_widgets() 765 # self.__disconnect_event() 766 # self._p.register('button_press',self._add_panel) 767 768 # def quit(self): 769 # self.__disconnect_event() 770 # self.disable_button() 771 # self._p.unmap() 772 # # self.figmgr.window.wm_withdraw() 773 774 # def enable_button(self): 775 # if self.button: return 776 # self.bRegion.setEnabled(True) 777 # self.bPanel.setEnabled(True) 778 # self.bClear.setEnabled(True) 779 # self.bFlag.setEnabled(True) 780 # self.bUnflag.setEnabled(True) 781 # self.bStat.setEnabled(True) 782 # # self.bRegion.config(state=Tk.NORMAL) 783 # # self.bPanel.config(state=Tk.NORMAL) 784 # # self.bClear.config(state=Tk.NORMAL) 785 # # self.bFlag.config(state=Tk.NORMAL) 786 # # self.bUnflag.config(state=Tk.NORMAL) 787 # # self.bStat.config(state=Tk.NORMAL) 788 # self.button = True 789 # self.spec_show() 790 791 # def disable_button(self): 792 # ## disable buttons which don't work for plottp 793 # if not self.button: return 794 # self.bRegion.setChecked(False) 795 # self.bRegion.setToolTip("select channel regions") 796 # self.bPanel.setChecked(False) 797 # self.bPanel.setToolTip("select subplots") 798 # # self.bRegion.config(relief='raised') 799 # # self.bPanel.config(relief='raised') 800 # self.bRegion.setDisabled(True) 801 # self.bPanel.setDisabled(True) 802 # self.bClear.setDisabled(True) 803 # self.bFlag.setDisabled(True) 804 # self.bUnflag.setDisabled(True) 805 # self.bStat.setDisabled(True) 806 # self.bNext.setDisabled(True) 807 # self.bPrev.setDisabled(True) 808 # # self.bRegion.config(state=Tk.DISABLED) 809 # # self.bPanel.config(state=Tk.DISABLED) 810 # # self.bClear.config(state=Tk.DISABLED) 811 # # self.bFlag.config(state=Tk.DISABLED) 812 # # self.bUnflag.config(state=Tk.DISABLED) 813 # # self.bStat.config(state=Tk.DISABLED) 814 # # self.bNext.config(state=Tk.DISABLED) 815 # # self.bPrev.config(state=Tk.DISABLED) 816 # self.button = False 817 # self.mode = '' 818 # self.notewin.close_widgets() 819 # self.__disconnect_event() 820 821 # def enable_next(self): 822 # self.bNext.setEnabled(True) 823 # # self.bNext.config(state=Tk.NORMAL) 824 825 # def disable_next(self): 826 # self.bNext.setDisabled(True) 827 # # self.bNext.config(state=Tk.DISABLED) 828 829 # def enable_prev(self): 830 # self.bPrev.setEnabled(True) 831 # # self.bPrev.config(state=Tk.NORMAL) 832 833 # def disable_prev(self): 834 # self.bPrev.setDisabled(True) 835 # # self.bPrev.config(state=Tk.DISABLED) 836 837 # # pause buttons for slow operations 838 # def _pause_buttons(self,operation="end",msg=""): 839 # buttons = ["bRegion","bPanel","bClear","bFlag","bUnflag","bStat", 840 # "bNote","bQuit"] 841 # if operation == "start": 842 # enable = False 843 # # state=Tk.DISABLED 844 # else: 845 # enable = True 846 # # state=Tk.NORMAL 847 # for btn in buttons: 848 # getattr(self,btn).setEnabled(enable) 849 # # getattr(self,btn).config(state=state) 850 # self.figmgr.toolbar.set_message(msg) 851 852 # def delete_bar(self): 853 # self.__disconnect_event() 854 # self.destroy() 855 856 # def __disconnect_event(self): 857 # self._p.register('button_press',None) 858 # self._p.register('button_release',None) 859 860 # def _draw_span(self,axes,x0,x1,**kwargs): 861 # height = self._p.figure.bbox.height 862 # y1 = height - axes.bbox.y1 863 # h = axes.bbox.height 864 # w = abs(x1 - x0) 865 # rect = [ int(val) for val in min(x0,x1), y1, w, h ] 866 # self._p.canvas.drawRectangle( rect ) 867 # # nothing is returned by drawRectangle 868 # return None 869 # # return self._p.canvas._tkcanvas.create_rectangle(x0,y0,x1,y1,**kwargs) 870 871 # def _remove_span(self,span): 872 # # Nothing to do with remove 873 # pass 874 # # self._p.canvas._tkcanvas.delete(span) -
trunk/python/customgui_tkagg.py
r2170 r2172 184 184 self._p.register('button_release',None) 185 185 186 def _draw_span(self,axes,x0,x1,**kwargs): 187 height = self._p.figure.bbox.height 188 y0 = height - axes.bbox.y0 189 y1 = height - axes.bbox.y1 190 return self._p.canvas._tkcanvas.create_rectangle(x0,y0,x1,y1,**kwargs) 191 192 def _remove_span(self,span): 193 self._p.canvas._tkcanvas.delete(span) 186 194 187 195
Note:
See TracChangeset
for help on using the changeset viewer.