Как изменить размер фото в tkinter? - PullRequest
1 голос
/ 17 июня 2019

Я настраиваю экран входа в систему с текстовым полем для ввода пароля и кнопкой входа в систему.Я хочу добавить логотип «Trounces» над текстовым полем пароля, но изображение слишком велико, и я не знаю, как изменить его размер.Любая помощь?

from tkinter import *
import tkinter as tk


class Window(Frame):

    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.master = master
        self.init_window()

    # Creation of init_window
    def init_window(self):
        photo = PhotoImage(file="trounceslogo.gif")
        quitBtn2 = Label(root, image=photo)
        quitBtn2.image = photo
        quitBtn2.pack()

        # placing a text box
        T = tk.Entry(root)
        T.pack()
        T.insert(tk.END, "Enter your password.")
        T.place(x=105, y=150)

        # changing the title of our master widget      
        self.master.title("Trounces Login")

        # allowing the widget to take the full space of the root window
        self.pack(fill=BOTH, expand=1)

        # creating a button instance
        LoginButton = Button(self, text="Login")

        # placing the button on my window
        LoginButton.place(x=175, y=200)


root = Tk()

# window size
root.geometry("400x240")

app = Window(root)
root.mainloop()  

Нет ошибок.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...