How do you make an animation with the title of a Tkinter window?

Steve

This is a bit of an eccentric question, but I would like an answer.

All I want to do is make an animation with the title of a window, by which I mean slowly deleting each letter of the title until it's blank. This is the example of the code in question.

def Clearcommand():
for letter in the_window.title():
    the_window.title(the_window.title()[:len(the_window.title())-1])

I was hoping that this code – when called by the button it's attached to – would delete a single letter off the end until the title is cleared.

The irritating part is that it doesn't break the code in question, it just seems to update the title once the 'Clearcommand' function ends.

Is there a way to force a window update that I'm overseeing, or am I going about this the wrong way?


Example code if you want to test it out:

from Tkinter import *

window = Tk()
window.title('This title contains so much guff.')

def Clearcommand():
    for letter in window.title():
        window.title(window.title()[:len(window.title())-1])

Clearbutton = Button(window,text = 'Clear Title',command = Clearcommand)
Clearbutton.pack(padx = 100)

window.mainloop()
Bryan Oakley

Do it like you do any other animation in tkinter: with after:

def Clearcommand():
    title = the_window.title()[:-1]
    the_window.title(title)
    if len(title) > 0:
        the_window.after(1000, Clearcommand)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how do you make a protected window in applescript?

From Dev

Tkinter : How to center the window title

From Dev

how do you get the title of the active window using autohotkey

From Dev

How do you make a scroll through animation in a listview?

From Dev

How do I make this button quit the parent window in tkinter?

From Dev

How do you make changes from a new windowManager window?

From Dev

How do you make a basic fullscreen window in Python?

From Dev

How to make a Tkinter window not resizable?

From Dev

Python tkinter 8.5 - How do you change focus from main window to a pop up window?

From Dev

Python Tkinter: How do you create a toplevel window and destroy the previous window?

From Dev

Python Tkinter: How do you create a toplevel window and destroy the previous window?

From Dev

How do you close a python - tkinter window, when the window object is encapsulated?

From Dev

Tkinter window title as a variable

From Dev

How do you test if a window (by title) is already open from the command prompt?

From Dev

how to do a "Save as" window with tkinter?

From Dev

How do I make the Xterm window title switch between the current running command and the current path?

From Dev

How to make a window fullscreen in a secondary display with tkinter?

From Dev

How to change the window title from a entry box tkinter

From Dev

How to change the function of 'x' button of a tkinter window ( one in the title bar )?

From Java

How do you set the document title in React?

From Dev

How do you set the title for UINavigationBar

From Dev

How do you add a colormap to a matplotlib Animation?

From Java

How do you make a calculator?

From Dev

How do you replace a label in Tkinter python?

From Dev

How do you refresh a label in tkinter and python

From Dev

How to make a main window large enough to show the full title

From Dev

How to make alt-tab diplay names of the program/window title?

From Dev

How can I make the Xubuntu window title bar transparent?

From Dev

How do you capture mouseout on window?

Related Related

  1. 1

    how do you make a protected window in applescript?

  2. 2

    Tkinter : How to center the window title

  3. 3

    how do you get the title of the active window using autohotkey

  4. 4

    How do you make a scroll through animation in a listview?

  5. 5

    How do I make this button quit the parent window in tkinter?

  6. 6

    How do you make changes from a new windowManager window?

  7. 7

    How do you make a basic fullscreen window in Python?

  8. 8

    How to make a Tkinter window not resizable?

  9. 9

    Python tkinter 8.5 - How do you change focus from main window to a pop up window?

  10. 10

    Python Tkinter: How do you create a toplevel window and destroy the previous window?

  11. 11

    Python Tkinter: How do you create a toplevel window and destroy the previous window?

  12. 12

    How do you close a python - tkinter window, when the window object is encapsulated?

  13. 13

    Tkinter window title as a variable

  14. 14

    How do you test if a window (by title) is already open from the command prompt?

  15. 15

    how to do a "Save as" window with tkinter?

  16. 16

    How do I make the Xterm window title switch between the current running command and the current path?

  17. 17

    How to make a window fullscreen in a secondary display with tkinter?

  18. 18

    How to change the window title from a entry box tkinter

  19. 19

    How to change the function of 'x' button of a tkinter window ( one in the title bar )?

  20. 20

    How do you set the document title in React?

  21. 21

    How do you set the title for UINavigationBar

  22. 22

    How do you add a colormap to a matplotlib Animation?

  23. 23

    How do you make a calculator?

  24. 24

    How do you replace a label in Tkinter python?

  25. 25

    How do you refresh a label in tkinter and python

  26. 26

    How to make a main window large enough to show the full title

  27. 27

    How to make alt-tab diplay names of the program/window title?

  28. 28

    How can I make the Xubuntu window title bar transparent?

  29. 29

    How do you capture mouseout on window?

HotTag

Archive