分类: Python Code

7 篇文章

python tkinte 文本编辑器
# 文本编辑器 from tkinter import * import tkinter.messagebox from tkinter.filedialog import askopenfilename from tkinter.filedialog import asksaveasfilename class FileEditor: def _…
python tkinter 端口扫描程序
import socket import tkinter.messagebox from tkinter import * class portScan: def __init__(self): window = Tk() window.title("端口扫描") frame = Frame(window) frame.pack() Label(f…
python tkinter IP地址查询程序
import socket from tkinter import * class ipAddress: def __init__(self): window = Tk() window.title("ipAddress") frame = Frame(window) frame.pack() Label(frame, text="域名:").gr…
python 控制台 猜谜语闯关游戏
import random class Riddle: def __init__(self, question, answer): self.__question = question self.__answer = answer def getQuestion(self): return self.__question def isRight(s…
python 控制台 测前世游戏
import random # 前世 class PastLife: def __init__(self, name, profession, life, causeOfDeath): self.name = name self.profession = profession self.life = life self.causeOfDeath =…
python 控制台 猜数游戏
import random min = 1 max = 100 number = random.randint(min, max) print(number) count = 0 while count < 10: guess = eval(input("Please enter a number between {} and {}:".fo…
python tkinter 写一个贪吃蛇
from tkinter import * import random # 游戏设置 GAME_WIDTH = 800 # 游戏宽度 GAME_HEIGHT = 800 # 游戏高度 SPEED = 50 # 贪吃蛇速度 SPACE_SIZE = 50 # 游戏单个部件的大小 BODY_PARTS = 3 # 贪吃蛇初始长度 SNAKE_COLOR…