Lv.1
java党一个个人QQ:3075929352
签名:肝个人网站ing…………
在 ( 急 ! )海龟编辑器怎么加载并显示多帧图???(要会切换帧) 中回复
import pygame
from pygame.locals import *
import os
import sys
import time
pygame.init()
screen = pygame.display.set_mode((480,喵0), 0, 32)
imgsDir = "D:/lsk/framebuffer/2/frames/"
imgs = []
def loadImageNames():
global imgs
for root,dirs,files in os.walk(imgsDir):
for file in files:
if file.endswith(".jpg"):
imgs.append(imgsDir + file)
loadImageNames()
index = 0
while True:
if index >= len(imgs):
index = 0
img = pygame.image.load(imgs[index]).convert()
screen.blit(img, (0, 0))
pygame.display.update()
for event in pygame.event.get():
if event.type == QUIT:
sys.exit()
index += 1
time.sleep(1 / 9)
我第一次用pygame,可能有点问题……
那个imgsdir变量就是图片的路径,然后sleep方法参数是相邻两张图片之间的时间
2021-06-20T20:05:29 点赞:0
在 编程猫帖子喵插件V1.0 中回复
修改:
1. require的内容是jquery的cdn地址
2. namespace的内容是http://tampermonkey。net(故意打成这样的)
3.第七行后面加上
// @match https://shequ.codemao.cn/community/*2021-06-20T20:19:40 点赞:1
在 找师傅啦!!!大神康康我!!! 中回复
某初一半python人来看看
放个程序装个13
#执行代码获取链接~
print("".join(chr(x) for x in list([104, 116, 116, 112, 115, 58, 47, 47, 103, 105, 116, 104, 117, 98, 46, 99, 111, 109, 47, 108, 115, 107, 45, 99, 104, 105, 110, 97, 47, 77, 101, 115, 115, 97, 103, 101, 76, 105, 115, 116, 101, 110, 101, 114])))2021-06-20T20:25:44 点赞:0
在 【Python作品分享】贪吃蛇测试版(v1.0)【求助帖】 中回复
改成这样
#绑定键盘函数
onkey(self.change_side_up, "W")
onkey(self.change_side_down, "S")
onkey(self.change_side_left, "A")
onkey(self.change_side_right, "D")
原因:onkey是turtle提供的,而不是screen
2021-06-20T21:00:41 点赞:0
在 如何在海龟编辑器上导入图片并显示 中回复
import cv2
img = cv2.imread("/mnt/home/pi/frames/0.jpg") #打开图片
cv2.imshow("test", img) #显示图片
cv2.waitKey(0)
cv2.destroyAllWindows()
OpenCV展示图片的写法。
python还有很多库可以展示图片,用法百度查
2021-06-27T18:06:11 点赞:0
在 【Python作品分享】任务3【求助帖】 中回复
from arcade import *
from arcade import color
open_window(600, 400, 'rainbow')
set_background_color(color.BLUE) # 补全这行代码
start_render()
finish_render()
run()
不知道你要什么效果,反正现在能运行了
2021-07-03T06:23:30 点赞:0
在 求助:由于目标计算机积极拒绝,无法连接。 中回复
#server side
from socket import*
from time import ctime
HOST = "0.0.0.0"
PORT = 12345
BUFSIZE = 1024
ADDR = (HOST, PORT)
tcpSerSock = socket(AF_INET, SOCK_STREAM)
tcpSerSock.bind(ADDR)
tcpSerSock.listen(5)
while True:
print("waiting for connection...")
tcpCLiSock, addr = tcpSerSock.accept()
print("...connected from:", addr)
while True:
data = tcpCLiSock.recv(BUFSIZE)
if not data:
break
tcpCLiSock.send("Hello".encode("UTF-8"))
tcpCLiSock.close()
tcpCLiSock.close()
#client side
from socket import *
HOST = "localhost"
PORT = 12345
BUFSIZ = 1024
ADDR = (HOST, PORT)
tcpCliSock = socket(AF_INET, SOCK_STREAM)
tcpCliSock.connect(ADDR)
while True:
data = input("> ")
if not data:
break
tcpCliSock.send(data.encode("UTF-8"))
data = tcpCliSock.recv(BUFSIZ)
if not data:
break
tcpCliSock.send(data)
tcpCliSock.close()
代码改好了,你这错误有点多
2021-07-09T13:15:21 点赞:0
在 『P-H专场』大家对GUI编程有怎样的看法 中回复
讨厌GUI,因为GUI编程太麻烦,代码不简洁
真要说那个好的话,python的GUI算是最舒服的,还比较简洁,java的javafx也还好,但是java的awt和swing是真的拉
2021-07-09T17:42:36 点赞:2