Changeset 1888
- Timestamp:
- 08/23/10 15:14:21 (14 years ago)
- Location:
- trunk/python
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/casatoolbar.py
r1885 r1888 200 200 command=self.stat_cal) 201 201 self.bNote=self._NewButton(master=self, 202 text=' note',202 text='notation', 203 203 command=self.modify_note) 204 204 self.bQuit=self._NewButton(master=self, -
trunk/python/notationwindow.py
r1886 r1888 137 137 #if axes.contains_point(pos): ### seems not working 138 138 # return axes 139 axbox = axes.get_position().get_points() 139 try: 140 axbox = axes.get_position().get_points() 141 except AttributeError: ### WORKAROUND for old matplotlib 142 axbox = self._oldpos2new(axes.get_position()) 140 143 if (axbox[0][0] <= pos[0] <= axbox[1][0]) and \ 141 144 (axbox[0][1] <= pos[1] <= axbox[1][1]): 142 145 return axes 143 146 return None 147 148 ### WORKAROUND for old matplotlib 149 def _oldpos2new(self,oldpos=None): 150 return [[oldpos[0],oldpos[1]],[oldpos[0]+oldpos[2],oldpos[1]+oldpos[3]]] 144 151 145 152 def _convert_pix2dat(self,pos,axes): … … 154 161 # left-/bottom-pixel, and pixel width & height of the axes 155 162 bbox = axes.get_position() 156 lbpos = bbox.get_points()[0] 157 wax = bbox.width 158 hax = bbox.height 163 try: 164 axpos = bbox.get_points() 165 except AttributeError: ### WORKAROUND for old matplotlib 166 axpos = self._oldpos2new(bbox) 159 167 # check pos value 160 if (pos[0] < lbpos[0]) or (pos[1] < lbpos[1]) \161 or (pos[0] > (lbpos[0]+wax)) or (pos[1] > (lbpos[1]+hax)):168 if (pos[0] < axpos[0][0]) or (pos[1] < axpos[0][1]) \ 169 or (pos[0] > axpos[1][0]) or (pos[1] > axpos[1][1]): 162 170 raise ValueError, "The position is out of the axes" 163 171 xlims = axes.get_xlim() … … 165 173 wdat = xlims[1] - xlims[0] 166 174 hdat = ylims[1] - ylims[0] 167 xdat = xlims[0] + wdat*(pos[0] - lbpos[0])/wax168 ydat = ylims[0] + hdat*(pos[1] - lbpos[1])/hax175 xdat = xlims[0] + wdat*(pos[0] - axpos[0][0])/(axpos[1][0] - axpos[0][0]) 176 ydat = ylims[0] + hdat*(pos[1] - axpos[0][1])/(axpos[1][1] - axpos[0][1]) 169 177 return (xdat, ydat) 170 178 … … 298 306 #twin.deiconify() 299 307 #twin.minsize(width=twin.winfo_width(),height=twin.winfo_height()) 308 twin.lift() 300 309 twin.withdraw() 301 310 return twin … … 440 449 height=self.textwin.winfo_height()) 441 450 (w,h) = self.textwin.minsize() 451 self.textwin.lift() 442 452 self.textwin.geometry("%sx%s+%s+%s"%(w,h,xpix,ypix)) 443 453
Note:
See TracChangeset
for help on using the changeset viewer.