Merhaba arkadaşlar, elimde kullanicinin adini soyadini ve yasadigi sehiri kullanicidan isteyip o verileri bir Excel ve txt dosyasina aktaran bir kod var.
Bu kodu basit bir WordPress sitesinde kullanip sitede kullanicidan bu bilgileri giremsini isteyeceğim ve kullanicinin girdigi veri benim laptopumda Excel dosyasina kaydedilmesini istiyorum. Bu mumkun mu?
Python:
import tkinter as tk.
import openpyxl.
def write_data():
fname = entry_fname.get()
age = entry_age.get()
city = entry_city.get()
with open('data.txt', 'a') as file:
file.write(fname.capitalize() + " " + age + " " + city.capitalize() + "\n")
worksheet.cell(row=row_num, column=1).value = fname.capitalize()
worksheet.cell(row=row_num, column=2).value = age.
worksheet.cell(row=row_num, column=3).value = city.capitalize()
workbook.save("data.xlsx")
label_output.config(text=fname.capitalize() + " " + age + " " + city.capitalize())
workbook = openpyxl.Workbook()
worksheet = workbook.active
worksheet['A1'] = "Name"
worksheet['B1'] = "Age"
worksheet['C1'] = "City"
with open('data.txt', 'r') as file:
row_num = 2
for line in file:
name, age, city = line.strip().split()
worksheet.cell(row=row_num, column=1).value = name.capitalize()
worksheet.cell(row=row_num, column=2).value = age.
worksheet.cell(row=row_num, column=3).value = city.capitalize()
row_num += 1
root = tk.Tk()
root.title("User Information")
label_fname = tk.Label(root, text="Name:")
label_fname.grid(row=0, column=0)
label_age = tk.Label(root, text="Age:")
label_age.grid(row=1, column=0)
label_city = tk.Label(root, text="Where do you live?:")
label_city.grid(row=2, column=0)
label_output = tk.Label(root, text="")
label_output.grid(row=3, column=0)
entry_fname = tk.Entry(root)
entry_fname.grid(row=0, column=1)
entry_age = tk.Entry(root)
entry_age.grid(row=1, column=1)
entry_city = tk.Entry(root)
entry_city.grid(row=2, column=1)
button_submit = tk.Button(root, text="Submit", command=write_data)
button_submit.grid(row=3, column=1)
root.mainloop()
Bu kodu basit bir WordPress sitesinde kullanip sitede kullanicidan bu bilgileri giremsini isteyeceğim ve kullanicinin girdigi veri benim laptopumda Excel dosyasina kaydedilmesini istiyorum. Bu mumkun mu?