Mercurial > code > home > repos > light9
changeset 156:224505b0c21e
smaller text
smaller text
better bounds updating (now only on mouse-up)
cooler demo
author | drewp |
---|---|
date | Mon, 07 Jul 2003 06:56:50 +0000 |
parents | 4c3060ceddcc |
children | 7d3a0f9107a8 |
files | flax/fieldsets/demo flax/tracker |
diffstat | 2 files changed, 17 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/flax/fieldsets/demo Mon Jul 07 06:56:15 2003 +0000 +++ b/flax/fieldsets/demo Mon Jul 07 06:56:50 2003 +0000 @@ -1,6 +1,11 @@ <?xml version='1.0' encoding='UTF-8'?> <fieldset version='1'> - <field y='40' x='30' name='light1' falloff='10'/> - <field y='70.9854106065' x='89.7809651165' name='light2' falloff='9.44161122397'/> - <field y='56.5504587159' x='39.8543897217' name='light3' falloff='9.02748404992'/> + <field y='64.518605176' x='64.4226431666' name='light1' falloff='10'/> + <field y='71.6297059084' x='64.1501958858' name='light2' falloff='9.44161122397'/> + <field y='62.2614165793' x='49.4797562176' name='light3' falloff='9.02748404992'/> + <field y='64.7105473806' x='39.4725745351' name='1ight3' falloff='9.02748404992'/> + <field y='70.0008620159' x='45.644638445' name='2ight3' falloff='9.02748404992'/> + <field y='70.7801243766' x='53.963092297' name='3ight3' falloff='9.02748404992'/> + <field y='68.1676620898' x='74.8416350959' name='4ight3' falloff='10.5270359255'/> + <field y='62.0408841822' x='79.8677043872' name='5ight3' falloff='9.02748404992'/> </fieldset>
--- a/flax/tracker Mon Jul 07 06:56:15 2003 +0000 +++ b/flax/tracker Mon Jul 07 06:56:50 2003 +0000 @@ -12,6 +12,8 @@ import Tkinter as tk +defaultfont="arial 8" + def pairdist(pair1,pair2): return sqrt((pair1[0]-pair2[0])**2+(pair1[1]-pair2[1])**2) @@ -136,7 +138,7 @@ outlinestipple='gray50') # make text - self.txt=c.create_text(0,0,text=f.name(),font="arial 10 bold", + self.txt=c.create_text(0,0,text=f.name(),font=defaultfont+" bold", fill='white',anchor='c', tags=self.tags) @@ -151,10 +153,12 @@ dworld=c.canvas2world_vector(*dcan) self.field.center(*(self.field.center()+dworld)) self._lastmouse=ev.x,ev.y - dispatcher.send("field coord changed") self.setcoords() # redraw def release(ev): - del self._lastmouse + if hasattr(self,'_lastmouse'): + del self._lastmouse + dispatcher.send("field coord changed") # updates bounds + c.tag_bind(self.txt,"<ButtonPress-1>",press) c.tag_bind(self.txt,"<B1-Motion>",motion) c.tag_bind(self.txt,"<B1-ButtonRelease>",release) @@ -167,9 +171,9 @@ worldmouse=self.canvas.canvas2world(ev.x,ev.y) currentdist=pairdist(worldmouse,self.field.center()) self.field.falloff(currentdist) - dispatcher.send("field coord changed") self.setcoords() c.tag_bind(outerring,"<B1-Motion>",motion) + c.tag_bind(outerring,"<B1-ButtonRelease>",release) # from above self.setcoords() @@ -248,7 +252,7 @@ ######################################################################## root=tk.Tk() - +root.wm_geometry('700x350') tra=Tracker(root) tra.pack(fill='both',exp=1)