python tclerror__tkinter.TclError:命令名称无效" .4302957584" (_tkinter.TclError: invalid command name ".4...

2013-04-17 12:09:25

0

When closing the python 3 program, I get a strange exception in the console.

The Python 3 code:

from tkinter import *

from random import randint

# Return a random color string in the form of #RRGGBB

def getRandomColor():

color = "#"

for j in range(6):

color += toHexChar(randint(0, 15)) # Add a random digit

return color

# Convert an integer to a single hex digit in a character

def toHexChar(hexValue):

if 0 <= hexValue <= 9:

return chr(hexValue + ord('0'))

else: # 10 <= hexValue <= 15

return chr(hexValue - 10 + ord('A'))

# Define a Ball class

class Ball:

def __init__(self):

self.x = 0 # Starting center position

self.y = 0

self.dx = 2 # Move right

你可能感兴趣的:(python,tclerror)