Windows 10
Python (3.8)
Библиотека pillow 8.1.2
Добрый вечер,
Пишу код создания тестирования с регистрацией. При нажатии на кнопку Регистрация не создает и не открывает новое окно с новыми определенными объектами,
Python (3.8)
Библиотека pillow 8.1.2
Добрый вечер,
Пишу код создания тестирования с регистрацией. При нажатии на кнопку Регистрация не создает и не открывает новое окно с новыми определенными объектами,
Python:
from tkinter import *
import tkinter as tk
from TestingProgramm import NewWindow
from Register import Register
from PIL import Image as PilImage
from PIL import ImageTk
class MainWindow:
def __init__(self, width, height, title="Math", resizable=(True, True)):
self.root = Tk()
self.root.title(title)
self.root.geometry(f'{width}x{height}+200+200')
self.root.resizable(resizable[0], resizable[1])
self.login = Entry
def run(self):
self.objects_on_the_screen()
self.root.mainloop()
def objects_on_the_screen(self):
Button(self.root, width=30, height=5, text="Регистрация",
command=self.create_window1(400, 500, "Registration"),
relief=GROOVE, bd=7, font=("Times New Roman", 15, "bold")).place(x=100, y=240)
Button(self.root, width=30, height=5, text="Начать тестирование",
relief=GROOVE, bd=7, font=("Times New Roman", 15, "bold")).place(x=100, y=410)
Button(self.root, image=self.photo_image).place(x=700, y=200)
Button(self.root, width=30, height=5, text="Выход", command=quit,
relief=GROOVE, bd=7, font=("Times New Roman", 15, "bold")).place(x=100, y=580)
def create_window(self, width, height, title="Test", resizable=(True, True)):
Register(self.root, width, height, title, resizable, icon)
Entry(self.root)
def create_window1(self, width, height, title="Test2", resizable=(True, True)):
Register(self.root, width, height, title, resizable, icon)
Entry(self.root)
if __name__ == "__main__":
window = MainWindow(1920, 1080)
window.run()
#__name__==__main__
from tkinter import *
class Register:
def __init__(self, parent, width, height, title="Registration", resizable=(False, False)):
self.root = Toplevel(parent)
self.root.title(title)
self.root.geometry(f"{width}x{height}+200+200")
self.root.resizable(resizable[0], resizable[1])
self.login_entry = Entry(self.root)
self.age_entry = Entry(self.root)
self.password_entry = Entry(self.root, show="*")
def gWindow(self):
Label(self.root, text="Login:", justify=LEFT).grid(row=0, column=0, sticky=W)
self.login_entry.grid(row=0, column=1, sticky=W + E, padx=5, pady=5)
Label(self.root, text="Age:", justify=LEFT).grid(row=1, column=0, sticky=W)
self.age_entry.grid(row=1, column=1, sticky=W + E, padx=5, pady=5)
Label(self.root, text="Password:", justify=LEFT).grid(row=2, column=0, sticky=W)
self.password_entry.grid(row=2, column=1, sticky=W + E, padx=5, pady=5)
def initialize(self):
gWindow()
#__name__==__Register__
from tkinter import *
class NewWindow:
def __init__(self, parent, width, height, title="Test", resizable=(False ,False), icon=None):
self.root = Toplevel(parent)
self.root.title(title)
self.root.geometry(f"{width}x{height}+200+200")
self.root.resizable(resizable[0], resizable[1])
if icon:
self.root.iconbitmap(icon)
#__name__==__TestingProgramm__
Последнее редактирование: