При попытке запустить скрипт выводит такую ошибку
Traceback (most recent call last):
File "D:\p_YT\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "D:\PyCharm\PyCharm Community Edition 2021.3.2\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_umd.py", line 198, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "D:\PyCharm\PyCharm Community Edition 2021.3.2\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/Admin/OneDrive/Рабочий стол/Сайты/Python/_Python-testworks/randomizer.py", line 58, in <module>
title = Label(frame, text='Randomizer', bg='Grey', fg='', font=('Arial', 20, 'bold'))
File "D:\p_YT\lib\tkinter\__init__.py", line 3177, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "D:\p_YT\lib\tkinter\__init__.py", line 2601, in __init__
self.tk.call(
_tkinter.TclError: unknown color name ""
Сам скрипт:
import random
import secrets
import string
import tkinter
from tkinter import *
from tkinter import messagebox
# -------------------IMPORT
def byt_generate():
def generate_random_string(lenght):
letters_and_digits = string.ascii_letters + string.ascii_uppercase + string.punctuation + string.hexdigits + string.digits
print("Generate password...")
pas = ''.join(secrets.choice(letters_and_digits) for i in range(lenght))
num = random.randint(0, 10)
print("Your password:" + pas)
info_str = f'Пароль: {str(pas)}'
messagebox.showinfo(title='Пароль', message=info_str)
generate_random_string(15)
def open_topllv():
openo = Toplevel()
openo.geometry('500x200')
openo['bg'] = 'grey'
openo.overrideredirect(True)
Label(frame, text='Выбери нужный...', bg='white', font=('Arial', 20, 'italy'))
Label.pack()
btn3 = Button(frame, text='Генерировать число', bg='red', command=generate_num)
btn3 = Button(frame, text='Генерировать букву', bg='red', command=generate_letter)
def generate_num():
iq = random.randint(0, 100)
k = Label(frame, text=f'Сгенерированное число {str(iq)}')
def generate_letter():
wq = string.ascii_letters
a1 = Label(frame, text=f'Ваша буква: {str(wq)}')
a1.pack()
# --------------------ROOT
root = Tk()
root['bg'] = '#78DBE2'
root.title('Randomizer')
root.wm_attributes('-alpha', 100)
root.geometry('500x350')
frame = Frame(root, bg='cyan')
frame.place(relwidth=1, relheight=1)
title = Label(frame, text='Randomizer', bg='Grey', fg='', font=('Arial', 20, 'bold'))
title.pack()
btn = Button(frame, text='Генерировать пароль', bg='white', command=byt_generate)
btn.pack()
btn2 = Button(frame, text='Другие генераторы', bg='white', command=open_topllv)
btn2.pack()
root.mainloop()
Помогите исправить эту ошибку