相关疑难解决方法(0)

在python中使用Tkinter编辑标题栏

我正在尝试向窗口添加自定义标题,但我遇到了麻烦.我知道我的代码不对,但是当我运行它时,它会创建2个窗口,一个只有标题tk,另一个更大的窗口有"Simple Prog".如何使tk窗口具有标题"Simple Prog"而不是具有新的附加窗口.我不认为我想要有Tk()部分,因为当我在我的完整代码中有这个时,会出现错误

from tkinter import Tk, Button, Frame, Entry, END

class ABC(Frame):
    def __init__(self,parent=None):
        Frame.__init__(self,parent)
        self.parent = parent
        self.pack()
        ABC.make_widgets(self)

    def make_widgets(self):
        self.root = Tk()
        self.root.title("Simple Prog")
Run Code Online (Sandbox Code Playgroud)

python tkinter titlebar

54
推荐指数
6
解决办法
16万
查看次数

额外的Tkinter GUI弹出窗口

我写了一堆产生GUI的代码.现在每当我运行代码时,它都会生成主GUI窗口和一个没有任何内容的小窗口.当我关闭较小的窗口时,大的主窗口消失.现在我一直在阅读其他类似问题的帖子,但我无法确定代码中的错误位置.

请帮忙 :)

跟进问题:如何添加背景图像而不是灰色无聊颜色?

这是它的样子. 在此输入图像描述

#%% GUI Interface

import Tkinter as tk
from tkFont import Font
from PIL import ImageTk, Image
from Tkinter import END

#This creates the main window of an application
window = tk.Toplevel()
window.title("Sat Track")
window.geometry("1200x800")
window.configure(background='#f0f0f0')

#Imports the pictures.
pic1 = "Globeview.png"
pic2 = "MercatorView.png"
pic3 = "currentweathercroppedsmall.png"
pic4 = "GECurrentcroppedsmall.png"

#Creates a Tkinter-compatible photo image, which can be used everywhere Tkinter expects an image object.
img1 = ImageTk.PhotoImage(Image.open(pic1))
img2 = ImageTk.PhotoImage(Image.open(pic2))
img3 = ImageTk.PhotoImage(Image.open(pic3))
img4 …
Run Code Online (Sandbox Code Playgroud)

python user-interface tkinter

0
推荐指数
1
解决办法
551
查看次数

标签 统计

python ×2

tkinter ×2

titlebar ×1

user-interface ×1