我正在尝试在不同于我通常通过 pip 使用的(Windows)设备上下载 auto-py-to-exe。但是,运行时出现错误(对不起,它太长了):
ERROR: Command errored out with exit status 1:
command: 'c:\users\tom\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\tom\\AppData\\Local\\Temp\\pip-install-aplljhe0\\gevent\\setup.py'"'"'; __file__='"'"'C:\\Users\\tom\\AppData\\Local\\Temp\\pip-install-aplljhe0\\gevent\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\tom\AppData\Local\Temp\pip-install-aplljhe0\gevent\pip-egg-info'
cwd: C:\Users\tom\AppData\Local\Temp\pip-install-aplljhe0\gevent\
Complete output (113 lines):
Traceback (most recent call last):
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 489, in _find_latest_available_vc_ver
return self.find_available_vc_vers()[-1]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
yield saved
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", …
Run Code Online (Sandbox Code Playgroud) 嗨,我在画圆时遇到问题ERROR: module object has no attribute 'circle'
。我究竟做错了什么?
还有我怎样才能把数字圈起来?
例如:(第一次点击是0的圆圈,第二次是1的圆圈等等)
import pygame
WHITE = (255, 255, 255)
BLUE = ( 0, 0, 255)
GREEN = ( 0, 255, 0)
RED = (255, 0, 0)
TEXTCOLOR = ( 0, 0, 0)
(width, height) = (200, 300)
running = True
def main():
global running, screen
pygame.init()
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption("TUFF")
screen.fill(background_color)
pygame.display.update()
while running:
ev = pygame.event.get()
for event in ev:
if event.type == pygame.MOUSEBUTTONUP:
drawCircle()
pygame.display.update()
if event.type == …
Run Code Online (Sandbox Code Playgroud) 我正在开发一款类似 RPG 的游戏,你的最大生命值可以在整个过程中得到提高。
我正在尝试制作一个脚本,该脚本将绘制一个 100 像素宽、值超过 100 的健康栏。
随着您的健康状况提高,健康栏的单位会变小。
这是我能想到的最好的:
#Draw Bar
import pygame
def SingleColorBar(surface,color,x,y,value,maxvalue):
xx=0
for hp in range(value):
pygame.draw.rect(surface, color, (x+xx,y,1,32), 0)
xx+= value/100
Run Code Online (Sandbox Code Playgroud)
这根本没有按预期工作!
我正在关注PySimpleGUI文档并在进行过程中进行自己的编辑。我对它很陌生,并且有使用 Tkinter 的经验。Tkinter 中有一个文本框,您可以通过代码获取Text(window, width=?, height=?, wrap=WORD, background=yellow)
。但是在 PySimpleGUI 中使用类似的代码:layout = [[sg.Text('Some text on Row 1')]]
- 创建一个标签。我的代码是:
import PySimpleGUI as sg
sg.theme('DarkAmber') # Add a touch of color
# All the stuff inside your window.
layout = [ [sg.Text('Some text on Row 1')],
[sg.Text('Enter something on Row 2'), sg.InputText()],
[sg.Button('Ok'), sg.Button('Close Window')],
[sg.Text('This is some text', font='Courier 12', text_color='blue', background_color='green')],
[sg.Listbox(values=('value1', 'value2', 'value3'), size=(30, 2), key='_LISTBOX_')]]
# Create the Window
window = …
Run Code Online (Sandbox Code Playgroud)