![](https://img-blog.csdnimg.cn/20200612142453364.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
Python
Python所有文章
辛沐宸
这个作者很懒,什么都没留下…
展开
-
双人五子棋Python
文件的 import sys import pygame from collections import namedtuple from collections import deque import random Position = namedtuple('Position', ['x', 'y']) class Renju(object): background_filename = 'chessboard.png' white_chessball_filename = 'white_c原创 2020-06-12 21:57:23 · 1113 阅读 · 0 评论 -
俄罗斯方块Python
# -*- coding: utf-8 -*- from tkinter import * import random #尚需改进,有待提高 #各种方块的表示,与参考方块的相对位置 shapedic={1:((0,0),(1,0),(0,-1),(1,-1)),#正方形 2:((0,0),(0,-1),(0,-2),(0,1)),#长条 3:((0,0),(0,-1),(1,0),(1,1)),#之字型 4:((0,0),(0,-1),(-原创 2020-06-27 21:19:58 · 311 阅读 · 0 评论 -
井字棋Python
题目: 用Python做一个井字棋 代码如下 X="X" O="O" EMPTY=" " #询问是否继续 def ask_yes_no(question): response=None; while response not in("y","n"): response=input(question).lower() return response #输入位置数字 def ask_number(question ,low,high): response=None原创 2020-06-14 16:32:23 · 382 阅读 · 0 评论 -
银杏树Python画图
题目: (Python画图) 画一个银杏树(美丑无所谓) 代码如下 from turtle import * from random import * from math import * def tree(n, l): pd() color("darkgoldenrod") pensize(n / 3) forward(l) if n > 0: b = random() * 15 + 10 c = random() * 15原创 2020-06-14 16:27:39 · 3691 阅读 · 3 评论 -
射方砖Python
题目: 用Python game做一个射方砖程序 import sys, pygame, random,os from time import* class Breakout(): def main(self): xspeed_init = 6 yspeed_init = 6 max_lives = 5 bat_speed = 30 score = 0 bgcolour = 0x2F, 0x4F, 0x原创 2020-06-14 16:23:27 · 189 阅读 · 0 评论 -
二维码随机生成Python
题目 随机生成二维码。代码如下 from qrcode import * x=input("\n请输入你想在二维码里面储存的文字:") print("\n请返回桌面查看") qr = QRCode() qr.add_data(x)删除线格式 img = qr.make_image() img.show()原创 2020-06-12 19:51:06 · 839 阅读 · 0 评论