简体   繁体   中英

Pygame midi module init fails

Working under Windows Seven. I imported pygame 1.9.3 on a Python 3.6 in order to use the midi module.

The following lines :

import pygame
pygame.midi.init()

are raising a compiler error :"module pygame has no attribute midi"

Trying another module like "mixer" seems to work.

Is the midi module not present in the latest pygame library? Any workaround?

You need to import midi module as follows:

import pygame
import pygame.midi

pygame.midi.init()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM