import random import os from tkinter import * from tkinter import font # Erstellung eines Fensters fenster = Tk() fenster.title('Russisch Roulette 1.3') fenster.geometry('330x200') fenster.resizable(0,0) #Liste generieren a=list(range(0,6)) for i in range(0,6): a[i]=0 a[random.randint(0,5)]=1 j=0 #Funktionen def button_click(): file=str(entryfile.get()) location=str(entryloc.get()) path=os.path.join(location,file) output=pathexist(path) labeloutput.config(text=str(output)) global j j+=1 def pathexist(path): global output if os.path.exists(path): if a[j]==1: os.remove(path) output=str('*PENG*') else: output=str('*Klick*') else: output=str('No File') return output #Labels labelfile=Label(text='Filename:') labelfile.place(x=24,y=10) entryfile=Entry() entryfile.place(x=104,y=10,width=200,height=20) labelloc=Label(text='File Location:') labelloc.place(x=24,y=40) entryloc=Entry() entryloc.place(x=104,y=40,width=200,height=20) buttonplay=Button(text='Play',command=button_click) buttonplay.place(x=40,y=90,width=250,height=30) labeloutput=Label(font=('arial',14,'bold')) labeloutput.place(x=130,y=150)