Exemplo n.º 1
0
    def show_frame(self):

        _, uframe = self.cap.read()
        self.frame = cv2.flip(uframe, 1)

        cv2image = cv2.cvtColor(self.frame, cv2.COLOR_BGR2RGBA)
        img = Image.fromarray(cv2image)
        imgtk = Image.PhotoImage(image=img)
        self.lmain.imgtk = imgtk
        self.lmain.configure(image=imgtk)
        self.lmain.after(10, self.show_frame)
Exemplo n.º 2
0
def back_image():
    my_image = Image.PhotoImage(Image.open('download'))
    label1 = tkinter.Label(image=my_image).pack()
Exemplo n.º 3
0
    def win1(self):
        self.i = 1
        self.root = tk.Tk()
        self.root.title('carrito')
        #root.iconbitmap('logo_aposento_nuevo_01_rKM_icon.ico')
        self.root.geometry('1000x528+0+0')
        self.root.configure(background='#266fb7')
        self.titulo = tk.Frame(self.root,
                               width=1000,
                               height=40,
                               bd=0,
                               relief='flat',
                               background='grey')
        self.titulo.pack(side="top")
        self.arriba = tk.Frame(self.root,
                               width=1000,
                               height=521.5,
                               bd=0,
                               relief='flat',
                               background='#ffffff')
        self.arriba.pack(side="top")

        self.cam = tk.Frame(self.arriba,
                            width=800,
                            height=481.5,
                            bd=3,
                            relief='sunken',
                            background='#ffffff')
        self.cam.pack(side="left")
        self.items = tk.Frame(self.arriba,
                              width=380,
                              height=481.5,
                              bd=0,
                              relief='flat',
                              background='#ffffff')
        self.items.pack(side="right")

        self.petra = tk.Label(self.titulo,
                              font=('arial', 20, 'bold'),
                              text='Petra market ',
                              bd=10,
                              background='#266fb7',
                              fg='#ffffff')
        self.petra.pack()
        self.objetos = tk.Text(self.items,
                               height=17,
                               bd=0,
                               relief="flat",
                               foreground="#898a8c",
                               highlightbackground="#ffffff")
        self.objetos.pack()
        self.objetos.config(state='disable')
        self.total = tk.Text(self.items,
                             height=4,
                             bd=0,
                             relief="flat",
                             foreground="#898a8c",
                             highlightbackground="#ffffff")
        self.total.pack()
        self.total.config(state='disable')

        self.listo = tk.Button(self.items,
                               text='Listo',
                               padx=15,
                               pady=10,
                               bd=0,
                               fg='#ffffff',
                               background='#266fb7',
                               command=self.listo).pack(pady=10)

        width, height = 800, 600
        self.cap = cv2.VideoCapture(0)
        self.cap.set(cv2.CAP_PROP_FRAME_WIDTH, width)
        self.cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height)
        self.root.bind('<Escape>', lambda e: self.root.quit())
        self.lmain = tk.Label(self.cam)
        self.lmain.pack()
        _, uframe = self.cap.read()
        self.frame = cv2.flip(uframe, 1)

        cv2image = cv2.cvtColor(self.frame, cv2.COLOR_BGR2RGBA)
        img = Image.fromarray(cv2image)
        imgtk = Image.PhotoImage(image=img)
        self.lmain.imgtk = imgtk
        self.lmain.configure(image=imgtk)
        self.lmain.after(10, self.show_frame)
        self.root.mainloop()