【问题标题】:pygame.midi.Input.read can't being a stringpygame.midi.Input.read 不能是字符串
【发布时间】:2021-06-09 11:27:06
【问题描述】:

我在 Ubuntu 20 上,我使用 Python 3.9。 我不能把pygame.midi.Input.read 的列表放到一个字符串中,因为否则,我的程序会用输出关闭:

pygame 1.9.6

Hello from the pygame community. https://www.pygame.org/contribute.html

[[[248, 0, 0, 0], 1]]

Exception: b"PortMidi: Bad pointer'"

Exception ignored in: 'pypm.Input.__dealloc__'

Exception: b"PortMidi: Bad pointer'"

所以,在这里,它起作用了:

def truc(myinput):

while True:

if myinput.poll():

event = str(myinput.read(3))

print(event)

pygame.midi.init()

my_input = pygame.midi.Input(3)

truc(my_input)

但是如果我在print(event) 后面加上这个,他就不行了

if '1' in event:

print('ok')

else:

return

你能帮帮我吗?

【问题讨论】:

    标签: python python-3.x ubuntu pygame midi


    【解决方案1】:

    发现问题:

    如果你遇到这个问题,你只需要不要放任何return

    再见

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-25
      • 2015-02-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-28
      • 1970-01-01
      • 2021-06-25
      相关资源
      最近更新 更多