pygame

How do you draw an antialiased circular line of a certain thickness? How to set width on pygame.gfx.aacircle()?

落花浮王杯 提交于 2021-01-05 09:13:37
问题 Like pygame.draw.circle(Surface, color, pos, radius, width) , I want to get antialiased circle. But, there is no option about width on pygame.gfxdraw.aacircle() . Anyone knows alternative way? 回答1: Neither the pygame.draw module nor the pygame.gfxdraw module provide a function for an antialiased circle with an scalable thickness. While pygame.draw.circle() can draw a circle with different width, pygame.gfxdraw.circle() can draw a thin, antialiased circle. You can try to stitch the circle with

How do you draw an antialiased circular line of a certain thickness? How to set width on pygame.gfx.aacircle()?

删除回忆录丶 提交于 2021-01-05 09:12:50
问题 Like pygame.draw.circle(Surface, color, pos, radius, width) , I want to get antialiased circle. But, there is no option about width on pygame.gfxdraw.aacircle() . Anyone knows alternative way? 回答1: Neither the pygame.draw module nor the pygame.gfxdraw module provide a function for an antialiased circle with an scalable thickness. While pygame.draw.circle() can draw a circle with different width, pygame.gfxdraw.circle() can draw a thin, antialiased circle. You can try to stitch the circle with

How can I randomly make holes in snake? [duplicate]

一个人想着一个人 提交于 2021-01-05 07:39:14
问题 This question already has answers here : how to handle time for different components in pygame (1 answer) How to run multiple while loops at a time in Python [duplicate] (1 answer) Pygame clock and event loops (1 answer) Closed 17 days ago . I have snake that is turning and drawing trajectory behind him but I don't know how to make holes like random pauses while he's drawing. I tried it and it's not random but problem is that it's very fast pause. It's like teleporting move. Here is my code:

python - Draw a transparent Line in pygame

南笙酒味 提交于 2021-01-03 06:41:49
问题 I made a little game in which i need a background pattern with lines. Because of a better performance I would like to draw the pattern in python instead of taking an image. The problem is that I can't find a way to draw the lines with transparency...there are solutions for surfaces, but not for lines. here is the pattern code: import pygame from math import pi pygame.init() size = [600, 600] screen = pygame.display.set_mode(size) while True: for i in range(0, 600, 20): pygame.draw.aaline

python - Draw a transparent Line in pygame

孤人 提交于 2021-01-03 06:41:22
问题 I made a little game in which i need a background pattern with lines. Because of a better performance I would like to draw the pattern in python instead of taking an image. The problem is that I can't find a way to draw the lines with transparency...there are solutions for surfaces, but not for lines. here is the pattern code: import pygame from math import pi pygame.init() size = [600, 600] screen = pygame.display.set_mode(size) while True: for i in range(0, 600, 20): pygame.draw.aaline

python - Draw a transparent Line in pygame

坚强是说给别人听的谎言 提交于 2021-01-03 06:41:17
问题 I made a little game in which i need a background pattern with lines. Because of a better performance I would like to draw the pattern in python instead of taking an image. The problem is that I can't find a way to draw the lines with transparency...there are solutions for surfaces, but not for lines. here is the pattern code: import pygame from math import pi pygame.init() size = [600, 600] screen = pygame.display.set_mode(size) while True: for i in range(0, 600, 20): pygame.draw.aaline

how to display PIL image with pygame?

拈花ヽ惹草 提交于 2021-01-02 20:30:16
问题 I am trying to do some video stream from my raspberry pi over the wifi. I used pygame, because i also have to use gamepad in my project. Unfortunately I stucked on displaying received frame. Shortly: i get jpeg frame, open it with PIL, convert to string - after that i can load image from string image_stream = io.BytesIO() ... frame_1 = Image.open(image_stream) f = StringIO.StringIO() frame_1.save(f, "JPEG") data = f.getvalue() frame = pygame.image.fromstring(frame_1,image_len,"RGB") screen

how to display PIL image with pygame?

时光毁灭记忆、已成空白 提交于 2021-01-02 20:29:34
问题 I am trying to do some video stream from my raspberry pi over the wifi. I used pygame, because i also have to use gamepad in my project. Unfortunately I stucked on displaying received frame. Shortly: i get jpeg frame, open it with PIL, convert to string - after that i can load image from string image_stream = io.BytesIO() ... frame_1 = Image.open(image_stream) f = StringIO.StringIO() frame_1.save(f, "JPEG") data = f.getvalue() frame = pygame.image.fromstring(frame_1,image_len,"RGB") screen

how to display PIL image with pygame?

a 夏天 提交于 2021-01-02 20:28:29
问题 I am trying to do some video stream from my raspberry pi over the wifi. I used pygame, because i also have to use gamepad in my project. Unfortunately I stucked on displaying received frame. Shortly: i get jpeg frame, open it with PIL, convert to string - after that i can load image from string image_stream = io.BytesIO() ... frame_1 = Image.open(image_stream) f = StringIO.StringIO() frame_1.save(f, "JPEG") data = f.getvalue() frame = pygame.image.fromstring(frame_1,image_len,"RGB") screen

Python除了做ai,还能干啥?

巧了我就是萌 提交于 2021-01-02 08:47:59
先说个笑话,很多人一开始学习 Python 的时候,会感到无聊和枯燥,因为一开始都不知道那些循环语句呀、列表呀、元组等知识点的用武之地,所以慢慢的就没什么动力了,然后就去买滑板鞋,开始在地上摩擦,像魔鬼的步伐。逢人就说:“Python没用,这玩意不好找工作,就是拿来玩玩~” 最近有不少 b 友想知道 Python 除了爬虫之外,还能玩点啥呢?那么小帅b接下来就来说说我知道的可以使用 Python 做的事情,让你发现更多的方向。 1、爬虫 这玩意不用我多说了,我最近分享的大部分教程就是爬虫,如果你对爬虫感兴趣的话可以看看我之前写的那些文章,也可以看看这个: python如何赚钱?python爬虫如何进阶?python就业?如何快速入门python?..... 2、数据分析 现在的人们越来越不理智了,总是把自己的想法强加到别人的身上,“感觉”会欺骗人,但是“数据”不会,数据是相对来说比较真实的反应,打开你的手机,看看在哪个应用的用时最长,你说你每天学习,但是一看,挖槽,抖音用了 3 个小时,PornHub 看了 4 个小时,你说你在学习? 这就是数据分析最简单的解释,对我们比较重视的事情,通过数据进行可视化分析,Python 让你理智些,克制些。 3、机器学习 现在不是各种吹人工智能么,机器学习就是人工智能的一个分支,它的应用太广泛了,比如自然语言处理,搜索引擎,各种识别技术