UT2k4Bench 1.3

Stellt hier eure Projekte vor.
Internetseiten, Skripte, und alles andere bzgl. Python.
Antworten
Iopodx
User
Beiträge: 68
Registriert: Sonntag 5. September 2004, 08:58

Hiho Gemeinde,

Gestern, spät am Abend, sprach mich mein Bruder an, ob ich wohl einen UT2004 Benchmark hätte. Ich sagte ja und gab ihm eine seehr umständliche eingabe Aufforderung. Da meinte er zu mir, dass es sehr umständlich sei, und ich sag kurz zu ihm, naja, gib mir 1h und du hast ein Programm dafür..

So nach 45Minuten schreiben, suchen, schreiben kam das heraus:


Code: Alles auswählen

from Tkinter import *
import os, ScrolledText, tkMessageBox
from time import sleep

def quit(root):
    root.quit()
    root.destroy()
def go(maps, mapl, bots, ini):
    if (ini[0]=="0"): 
        inis="Default.ini"
    else:
        inis="UT2004.ini"
    map=maps[int(mapl[0])].lower()
    if (int(bots) >32):
        a=tkMessageBox.askyesno("Warnung!", "Achtung, UT2004 erlaubt maximal 32Bots! Trotzdem starten?")
        if(a==True):
            pipe=os.popen(os.getcwd()+"\System\ut2004.exe "+map+"?spectatoronly=1?numbots="+str(bots)+"?quickstart=1?attractcam=1 -benchmark -seconds=77 -ini="+inis+" -exec=../Benchmark/Stuff/botmatchexec.txt")
        else:
            pass
    elif(int(bots) <=32):
        pipe=os.popen(os.getcwd()+"\System\ut2004.exe "+map+"?spectatoronly=1?numbots="+str(bots)+"?quickstart=1?attractcam=1 -benchmark -seconds=77 -ini="+inis+" -exec=../Benchmark/Stuff/botmatchexec.txt")
root=Tk()
scroll_y = Scrollbar(root, orient=VERTICAL) 
scroll_y.grid(row=1, column=1, sticky="NS")
listbox = Listbox(root, width=50, selectmode=SINGLE, yscrollcommand=scroll_y.set, exportselection=0)
scroll_y.config(command=listbox.yview) 
listbox.grid(row=1, column=0)
inibox=Listbox(root, width=10, selectmode=SINGLE, exportselection=0)
inibox.grid(row=1, column=4)
inibox.insert(END, "Default.ini")
inibox.insert(END, "UT2004.ini")
map=os.listdir(os.getcwd()+"/Maps")
maps=[]
try:  
    root.iconbitmap(os.getcwd()+"\Help\Unreal.ico")
except:
    print "\Help\Unreal.ico nicht gefunden!"
for row in map:
    a=row.split(".")
    maps.append(a[0])
for line in maps:
    listbox.insert(END, line)
Label(root, text="MAP").grid(row=0, column=0)
Label(root, text="BOTS").grid(row=1, column=3)
Label(root, text=" INI").grid(row=0, column=4)
BotsE=Entry(root, width=2)
BotsE.grid(row=1, column=2)
BotsE.insert(END, "14")
root.title("UT2k4 Bench 1.3")
Button(root, fg="red", text="Run", command=lambda:go(maps, listbox.curselection(), BotsE.get(), inibox.curselection())).grid(row=2, column=0)
Button(root, fg="blue", text="Quit", command=lambda:quit(root)).grid(row=2, column=3)
root.mainloop()

MfG
Iopodx
Antworten