0

When my script converted to .exe is launched by a person who does not have the necessary images and audio files, these images and audio files are not displayed in his program. How can I make everyone see them? Is it possible to download files from the Internet or something else?

import pyautogui as pg
from pygame import mixer
import pygame
import pyglet
from tkinter import *
from tkinter import messagebox
from ctypes import cast, POINTER
from comtypes import CLSCTX_ALL
from pycaw.pycaw import AudioUtilities, IAudioEndpointVolume
import requests as rqs



pygame.mixer.init()
pygame.init()
pygame.mixer.music.set_volume(100)


mixer.music.load('D:\Programs\games\Python\Projects\MEDIA\Sm.mp3')
pp = pygame.image.load('D:\Programs\games\Python\Projects\MEDIA\pp.png')

pg.alert("Вы установили смачный вирус!", "ERROR", button = "Продолжить" )
pg.confirm("Точно продолжить?", ("НЕТ!"))
pg.password("Введите пароль для отмены")
pg.alert("Пароль неверный!", "ERROR" )

devices = AudioUtilities.GetSpeakers()
interface = devices.Activate( IAudioEndpointVolume._iid_, CLSCTX_ALL, None)
volume = cast(interface, POINTER(IAudioEndpointVolume))
volume.SetMasterVolumeLevel(-0.0, None)




screen = pygame.display.set_mode((1920, 1080))
screen.blit(pp, (0, 0))
volume.SetMasterVolumeLevel(-0.0, None)
time.sleep(5)
volume.SetMasterVolumeLevel(-0.0, None)
mixer.music.play(-1)




while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            screen = pygame.display.set_mode((1920, 1080))
            screen.blit(pp, (0, 0))

            mixer.music.play(-1)
            pg.move(10000, 10000)
            pg.move(10000, 10000)
            volume.SetMasterVolumeLevel(-0.0, None)

    pygame.display.update() ``` 

КОТ
  • 1

1 Answers1

0

It isn't possible to display files that aren't there. The easiest solution would be to simply include the necessary files when sending your programme to users (you might also want to try using relative file paths instead of assuming other users will have everything saved in 'D:\Programs\games\Python\Projects'.

If you want to go for the download route, try hosting the necessary files publicly on Google Drive or something similar and taking a looking at this question if you are unsure how to download the files.