0

I'm trying to add the ScrolledText widget to a Tkinter window. The program reads it perfectly as in it accepts the INSERT method for it with no errors but it's not showing up. The problem came up when I added Notebook Tabs. I've attached the code snippet. I used the place() method because I need the rest of my buttons and labels arranged in a specific pattern.

import tkinter
from tkinter import *
from tkinter import scrolledtext
from tkinter import messagebox
from tkinter import ttk
import os
import datetime

# Variables
window = Tk()
window.title("Vesnica Pomenire")
window.geometry('1500x1000')
var = IntVar()
var.set(1)

txt = scrolledtext.ScrolledText(window,width=40,height=10)
txt.place(x=50, y=50)
4

2 回答 2

0

你错过了mainloop()

import tkinter
from tkinter import *
from tkinter import scrolledtext
from tkinter import messagebox
from tkinter import ttk
import os
import datetime

# Variables
window = Tk()
window.title("Vesnica Pomenire")
window.geometry('1500x1000')
var = IntVar()
var.set(1)

txt = scrolledtext.ScrolledText(window,width=40,height=10)
txt.place(x=50, y=50)

window.mainloop() #You are missing this

你可以在这里阅读更多mainloop()

于 2021-04-20T03:28:35.790 回答
0

你真的错过了 mainloop 命令

window.mainloop()

在你的代码底部添加它,它会做的事情

于 2021-04-20T04:44:56.770 回答