Neler yeni

Sporcu Analiz Programı / Python

dexStap

Yazar
Katılım
28 Ocak 2022
Mesajlar
57
Tepkime puanı
134
Puanları
350
Python yazılım dili yapılmış bir sporcu analiz programıdır. Kodları aşağıdan kopyalayabilirsiniz. Bu program spor dallarından biri olan güreş için yapılmıştır. Dosyayı istediğiniz spor dalı üzerine derleyebilirsiniz. Yazdırmak istediğiniz zaman dosyayı '.xlsx ' uzantısı olarak istediğiniz dizine kaydetmektedir.

Sporcu Analiz.PNG

Python:
from tkinter import filedialog
from openpyxl import Workbook
from tkinter import *
from time import *


objects = []

class olustur():
    def increase(self):
        for i in objects:
            if i["haraket"] == self.haraket:
                i["amount"] += 1
                self.string.set(i["amount"])
    def reduce(self):
        for i in objects:
            if i["haraket"] == self.haraket:
                if i["amount"] != 0:
                    i["amount"] -= 1
                    self.string.set(i["amount"])
    def __init__(self,haraket):
        self.haraket = haraket
        self.amount = 0
        self.string = StringVar()
        x = (len(objects)-int(len(objects)/7)*7)*180 + 15
        y = int(int(len(objects)/7)*95) + 1
        Label(pencere, text=f"{haraket}: ").place(x=x, y=y)
        giris = Entry(font="Verdena 14 bold", width=10, justify=RIGHT, textvariable=self.string, state="disabled")
        giris.place(x=x + 5, y=y + 20)
        Button(command=self.increase, text="Ekle").place(x= x + 5, y = y + 50)
        Button(command=self.reduce, text="Çıkar").place(x = x + 80, y = y + 50)
        objects.append({"haraket":haraket,"amount":0,"ob":self.string})

def reset():
    wrestler1.delete(0, 'end')
    for i in objects:
        i["amount"] = 0
        i["ob"].set(0)
    print(objects)

def clock():
    text = strftime('%H:%M:%S')
    label.config(text=text)
    label.after(1000,clock)

def save():
    filename = filedialog.asksaveasfilename(initialdir='/', title='Save File', filetypes=(('Text Files', '.xlsx'), ('All Files', '*.*')))

    row = 1
    wb = Workbook()
    wb['Sheet'].title = "Report of Automation"
    sh1 = wb.active
    sh1["A2"].value = "İsim:"
    sh1["B2"].value = wrestler1.get()
    for e,i in enumerate(objects):
        sh1[f"A{e+6}"].value=objects[e]["haraket"]
        sh1[f"B{e+6}"].value=objects[e]["amount"]


    wb.save(f"{filename}")




pencere = Tk()
pencere.title("Sporcu Analiz Programı")
pencere.geometry("1250x600")

olustur("Sağa Dalış")
olustur("Sola Dalış")
olustur("Sağa Yana Dalış")
olustur("Sola Yana Dalış")
olustur("İleri Adım")
olustur("Geri Adım")
olustur("Dışarı Basma")
olustur("Sağa Tekkol")
olustur("Sola Tekkol")
olustur("Sağa Kafakol")
olustur("Sola Kafakol")
olustur("Sağdan Danabağ")
olustur("Soldan Danabağ")
olustur("İhtar")
olustur("Sağa Çırpma")
olustur("Sola Çırpma")
olustur("Sağdan Kol Çekme")
olustur("Soldan Kol Çekme")

##################################################################
lb = LabelFrame(text="Güreşçi", width=255, height=60)
lb.place(x=15, y=550)
wrestler1 = Entry(font="Helvetica 16", width=20, justify=RIGHT)
wrestler1.place(x=20, y=565)
##################################################################

Button(command=reset,text="Sıfırla").place(x=1175,y=565)

Button(command=save,text="Yazdır").place(x=1100,y=565)

####################################################
lb = LabelFrame(text="Saat", width=150, height=60)
lb.place(x=945, y=550)
label = Label(pencere, font=("ds-digital",20))
label.place(x=950,y=565)
####################################################

clock()
pencere.mainloop()
 

                                                                                                  
Üst Alt