I want to make a script (GUI) in which I have to convert my text to a png file with the handwriting but I still get this error
I try with "\\"
instead of "\"
at path
I want to change its name every time I make a new file, because it replaces the old file with a new one
File "C:\Users\790\OneDrive\Desktop\scrisdemana\main.py", line 16, in click
os.rename(r'C:\\Users\\790\\OneDrive\Desktop\\handwriting\\here.png',r'C:\\Users\790\\OneDrive\Desktop\\handwriting\\handwriting_' + str(x) + '.png')
OSError: [WinError 87] The parameter is incorrect: 'C:\\\\Users\\\\790\\\\OneDrive\\Desktop\\\\handwriting\\\\here.png' -> 'C:\\\\Users\\790\\\\OneDrive\\Desktop\\\\handwriting\\\\handwriting_2021-06-20 13:20:22.660063.png'
this is my code:
from tkinter import *
import pywhatkit as pwt
import os
import time
import datetime
#pwt.text_to_handwriting("text","C:\\Users\\790\\OneDrive\\Desktop\\scrisdemana\\here.png", [10, 10, 10])
def click():
x = datetime.datetime.now()
entered_text = textentry.get()#this will collect the text from the text entry box
output.delete(0.0, END)
definition = pwt.text_to_handwriting(entered_text,"C:\\Users\\790\OneDrive\\Desktop\\handwriting\\here.png", [10, 10, 10])
os.rename(r'C:\Users\790\OneDrive\Desktop\handwriting\here.png',r'C:\Users\790\OneDrive\Desktop\handwriting\handwriting_' + str(x) + '.png')
output.insert(END, definition.text)
#### main:
window = Tk()
window.title("Translator")
window.configure(background="cyan")
#create label
Label (window, text="Pune aici textul:", bg="cyan", fg="black", font="none 12 bold") .grid(row=1, column=0, sticky=W)
#create a text entry box
textentry = Entry(window, width=30, bg="white")
textentry.grid(row=2, column=0, sticky="W")
#add submit button
Button(window, text="Convert", width=6, command=click) .grid(row=5, column=0, sticky="W")
#create another label
Label (window, text="Output:", bg="cyan", fg="black", font="none 12 bold") .grid(row=6, column=0, sticky="E")
#create a text box
output = Text(window, width=30, height=6, wrap=WORD, background="white")
output.grid(row=7, column=0, columnspan=2, sticky="E")
#the dictionary
my_compdictionary = ""
#####run the main loop
window.mainloop()