Problems in transforming . py to . exe from my project to recognize images with opencv

Asked

Viewed 35 times

1

I have a project of recognizing images using opencv, I separated it into 3 packages plus the code of the graphical interface in Tkinter that controls the activation. It works normally, but when I turn to . exe from running error (I used pyinstaller, auto-py-to-exe, cx_Freeze and always the same). Follow my main code:

from tkinter import *
from Bot import play
from PIL import Image, ImageTk


bo = False


def loop():
    if bo:
        play.bot()
    root.after(750, loop)


def eventstart():
    global bo
    bg.config(image=img2)
    bstart.forget()
    bstop.pack(side=TOP)
    bo = True


def eventstop():
    global bo
    bo = False
    bg.config(image=img1)
    bstop.forget()
    bstart.pack(side=TOP)


root = Tk()


bo = False
root.wm_attributes("-topmost", 1)
root.geometry('300x200+0+0')
root.title('BOTFT')
root.iconbitmap('FindObjects/Images/Icon/icon.ico')
img1 = ImageTk.PhotoImage(Image.open("FindObjects/Images/Background/bg1.png"))
img2 = ImageTk.PhotoImage(Image.open("FindObjects/Images/Background/bg2.png"))
bg = Label(root, image=img1)
frame = Frame(root)
bstart = Button(frame, text='Start', width=8, height=7, command=lambda: eventstart())
bstop = Button(frame, text='Stop', width=8, height=7, command=lambda: eventstop())
bsett = Button(frame, text='Settings', width=8, height=2)
bg.pack(side=LEFT)
frame.pack(side=RIGHT)
bstart.pack(side=TOP)
bsett.pack(side=BOTTOM)


root.after(750, loop)
root.mainloop()

The play function, in the Bot package, performs several functions of the Find module, which is inside the Findobjects package. Inside Findobjects are also all the images that are inside the Images package, which also has the module with functions that takes screenshots and stores in the Screenshots folder inside Images. It also has a tool package where I define functions to use opencv, pywin32, etc. more easily. I have some modules and packages, I may not understand how to join all this in an exe.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.