Python Forum
[Tkinter] How to show text in window?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] How to show text in window?
#4
import time
import tkinter as tk
from tkinter import Text, filedialog

root = tk.Tk()


def forecast():
    print("My Forecast")
    label['text'] = "My Forecast"


def models():
    print("Models selected. ")
    label['text'] = "Models selected. "


canvas = tk.Canvas(root, height=480, width=640, bg='black')
canvas.pack()

frame = tk.Frame(root, bg='black')
frame.place(relwidth=0.6, relheight=0.6, relx=0.1, rely=0.1)
label = tk.Label(frame, fg='white', bg='black')
label.pack()
forecast = tk.Button(root, text="Forecasts", padx=2, pady=3,
                     fg='white', bg="red", command=forecast)
forecast.pack()

models = tk.Button(root, text="Models", padx=2, pady=3,
                   fg='white', bg="red", command=models)
models.pack()

tk.mainloop()
Reply


Messages In This Thread
How to show text in window? - by wxnerd - Jun-20-2020, 03:23 PM
RE: TKinter: Same Window Help - by Yoriz - Jun-20-2020, 03:34 PM
RE: TKinter: Same Window Help - by wxnerd - Jun-20-2020, 03:53 PM
RE: TKinter: Same Window Help - by Yoriz - Jun-20-2020, 04:01 PM
RE: TKinter: Same Window Help - by wxnerd - Jun-20-2020, 04:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Interaction between Matplotlib window, Python prompt and TKinter window NorbertMoussy 3 900 Mar-17-2024, 09:37 AM
Last Post: deanhystad
  Transparent window background, but not text on it muzicman0 7 3,274 Feb-02-2024, 01:28 AM
Last Post: Joically
  [PyQt] Hover over highlighted text and open popup window DrakeSoft 2 1,687 Oct-29-2022, 04:30 PM
Last Post: DrakeSoft
  tkinter window and turtle window error 1885 3 6,903 Nov-02-2019, 12:18 PM
Last Post: 1885
  [Tkinter] Text window not properly sized smabubakkar 1 1,973 Jun-16-2019, 08:55 AM
Last Post: Yoriz
  [PyQt] Can't show PyQt5 mediaPlayer in window DecaK 1 5,496 Sep-15-2018, 09:54 AM
Last Post: Axel_Erfurt
  update a variable in parent window after closing its toplevel window gray 5 9,332 Mar-20-2017, 10:35 PM
Last Post: Larz60+
  Show second window using classes iFunKtion 2 3,848 Feb-10-2017, 12:50 PM
Last Post: iFunKtion
  Show GPG keys in pyqt5 window Fred Barclay 1 4,751 Oct-24-2016, 07:09 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020