License GNU General Public License, version 2
Lines 18
fun (1) jump (1) malicious (5) python (33) tkinter (5) window (1)
Included in this Library
Owner: impiaaa
Viewable by Everyone
Editable by All Siafoo Users
Writing an article is easy - try our reStructured Text demo Join Siafoo Now or Learn More

Jumping window Atom Feed 2

In Brief Revised version of my run-away button.
# 's
 1from Tkinter import *
2import random, tkMessageBox
4root = Tk()
5WIDTH, HEIGHT = 1000, 700
6def move(event=None):
7 global root
8 root.geometry("%dx%d%+d%+d" % (16, 32, random.randrange(WIDTH), random.randrange(HEIGHT)))
9def click(event=None):
10 return
11 while True: tkMessageBox.showerror("Error", "Internal error. Please restart.")
12button = Button(root, text="Click me!", command=click)
14button.bind("<space>", move)
15root.bind("<Tab>", move)
16root.bind("<Enter>", move)
17root.bind("<Motion>", move)
18root.resizable(False, False)

Revised version of my run-away button.


over 11 years ago (23 Feb 2009 at 01:09 PM) by David Isaacson
Awesome! And wow that *is* really annoying... it doesn't seem to preserve width and height when it jumps though?
over 10 years ago (18 Jul 2010 at 09:49 AM) by scott_r
That seems to be an intentional part of the annoyance factor, although I agree, it's a tad more fun to make the window jump "as is". On line 8, just adjust '16, 32' to whatever width, height you prefer.

As simple as this program is, played on an unsuspecting and slightly paranoid user, it's a bit like driving a cat nuts with a laser pointer... :)