ich beschäftige mich seit zwei Wochen das erste Mal mit Python. Ich habe für ein Projekt an der Uni die Aufgabe, eine Benutzeroberfläche für ein Raspberry Pi Touch zu entwerfen. Ich habe schon eine Oberfläche mit Buttons und verschiedenen frames (Klick Button -> Neuer Frame) erstellt. Die nächste Aufgabe, die ich lösen will, ist es per Klick auf einen Button, ein Bild mit einer Webcam aufzunehmen und dieses unter einem bestimmten Pfad abzuspeichern. Da ich wirklich noch nicht viel über Python weiß, würde ich mich freuen, wenn mir jemand sagen kann, wie ich an die Sache herangehen soll zB benötige ich andere Module etc.?
Soweit wäre ich schon mal
Code: Alles auswählen
from tkinter import *
def raise_frame(frame):
frame.tkraise()
root = Tk()
root.geometry('800x480')
f1 = Frame(root) #Main menu
f2 = Frame(root) #Automatic mode
f3 = Frame(root) #Manual mode
f4 = Frame(root) #Picture mode
f5 = Frame(root) #Copyright
image1 = PhotoImage(file='das.png')
bild1 = Label(f1,image=image1,background='white')
bild1.pack()
image2 = PhotoImage(file='Automatic_BG.png')
bild2 = Label(f2,image=image2,background='white')
bild2.pack()
image3 = PhotoImage(file='Manual_BG.png')
bild3 = Label(f3,image=image3,background='white')
bild3.pack()
image4 = PhotoImage(file='PICTURE_BG.png')
bild4 = Label(f4,image=image4,background='white')
bild4.pack()
image5 = PhotoImage(file='COPY_BG.png')
bild5 = Label(f5,image=image5,background='white')
bild5.pack()
for frame in (f1, f2, f3, f4, f5):
frame.grid(row=0, column=0, sticky='news')
button1 = Button(f1,text='AUTOMATIC MODE',command=lambda:raise_frame(f2),activeforeground = 'grey',height = 1, width = 30)
button1.place(x='20',y='200')
button2 = Button(f2,text='Back',command=lambda:raise_frame(f1),activeforeground = 'grey',height = 1, width = 7)
button2.place(x='20',y='450')
button3 = Button(f1, text='MANUAL MODE', command=lambda:raise_frame(f3),activeforeground = 'grey',height = 1, width = 30)
button3.place(x='20',y='260')
button4 = Button(f3,text='Back',command=lambda:raise_frame(f1),activeforeground = 'grey',height = 1, width = 7)
button4.place(x='20',y='450')
button5 = Button(f1, text='PICTURE MODE', command=lambda:raise_frame(f4),activeforeground = 'grey',height = 1, width = 30)
button5.place(x='20',y='320')
button6 = Button(f4,text='Back',command=lambda:raise_frame(f1),activeforeground = 'grey',height = 1, width = 7)
button6.place(x='20',y='450')
button7 = Button(f1, text='Copyright 2017 - ADLight',command=lambda:raise_frame(f5),activeforeground = 'grey',height = 1, width = 30)
button7.place(x='20',y='450')
button8 = Button(f5,text='Back',command=lambda:raise_frame(f1),activeforeground = 'grey',height = 1, width = 7)
button8.place(x='20',y='450')
Copyright = Label(f5,text='Urherberrecht')
Copyright.place(x='400',y='150',anchor='center')
raise_frame(f1)
root.mainloop()