Kaydet (Commit) 5cc31292 authored tarafından Guido van Rossum's avatar Guido van Rossum

Vladimir Marangozov's patch:

The separator dances too much and seems to jump by arbitrary amounts
in arbitrary directions when I try to move it for resizing the frames.
This patch makes it more quiet.
üst 8d43a293
...@@ -45,6 +45,7 @@ class Separator: ...@@ -45,6 +45,7 @@ class Separator:
f[dim] = getattr(f, "winfo_"+dim)() f[dim] = getattr(f, "winfo_"+dim)()
self.div.bind("<Motion>", self.div_motion) self.div.bind("<Motion>", self.div_motion)
self.div.bind("<ButtonRelease-1>", self.div_release) self.div.bind("<ButtonRelease-1>", self.div_release)
self.div.grab_set()
def div_motion(self, event): def div_motion(self, event):
delta = getattr(event, self.dir) - getattr(self.press_event, self.dir) delta = getattr(event, self.dir) - getattr(self.press_event, self.dir)
...@@ -61,6 +62,7 @@ class Separator: ...@@ -61,6 +62,7 @@ class Separator:
def div_release(self, event): def div_release(self, event):
self.div_motion(event) self.div_motion(event)
self.div.unbind("<Motion>") self.div.unbind("<Motion>")
self.div.grab_release()
class VSeparator(Separator): class VSeparator(Separator):
...@@ -84,6 +86,7 @@ def main(): ...@@ -84,6 +86,7 @@ def main():
tlist.append(t) tlist.append(t)
tlist[0].insert("1.0", "Make your own Mondrian!") tlist[0].insert("1.0", "Make your own Mondrian!")
tlist[1].insert("1.0", "Move the colored dividers...") tlist[1].insert("1.0", "Move the colored dividers...")
root.mainloop()
if __name__ == '__main__': if __name__ == '__main__':
main() main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment