如何在tkinter窗口中绘制图像(我使用的是python 3.3)?我正在寻找一个声明,它会在tkinter窗口的给定位置绘制图像.
是啊...
任何答案将不胜感激.这里是我想要使用代码的程序的源代码(如果它可以被称为),以防你需要它.
from tkinter import *
class craftClass():
def __init__(self, x = 80, y = 80, xmotion = 0, ymotion = 0, health = 20):
self.xPos, self.yPos = x, y
self.dx, self.dy = xmotion, ymotion
def moveCraft(self):
self.xPos += self.dx
self.yPos += self.dy
class missileClass():
def __init__(self, x = 0 , y = 0):
self.xPos, self.yPos = x, y
class alienClass():
def __init__(self, x, y):
self.xPos, self.yPos = x, y
def moveForCraft(self, craftX, craftY):
if self.xPos < craftX: …Run Code Online (Sandbox Code Playgroud) 在操作photoimage对象时,使用:
import tkinter as tk
img = tk.PhotoImage(file="myFile.gif")
for x in range(0,1000):
for y in range(0,1000):
img.put("{red}", (x, y))
Run Code Online (Sandbox Code Playgroud)
put操作需要很长时间.有更快的方法吗?