Python Forum
[Tkinter] question for a tkinter dialog box
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] question for a tkinter dialog box
#1
import tkinter as tk

root = tk.Tk()
logo = tk.PhotoImage(file="python_logo_small.gif")

w1 = tk.Label(root, image=logo).pack(side="right")

explanation = """At present, only GIF and PPM/PGM
formats are supported, but an interface 
exists to allow additional image file
formats to be added easily."""

w2 = tk.Label(root,
              justify=tk.LEFT,
              padx = 10,
              text=explanation).pack(side="left")
root.mainloop()
new to python and tkinter , here a sample code I got in this tutor for tkinter .

So between root = tk.Tk() and root.mainloop() is the code for this dialog box.
My question is w1 and w2 . These are defined but do not understand how they are called to be used in root.mainloop() ?
Yoriz write Aug-24-2021, 10:51 PM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Messages In This Thread
question for a tkinter dialog box - by RobertAlvarez424 - Aug-24-2021, 10:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Beginner question re: Tkinter geometry return2sender 3 947 Jun-19-2023, 06:19 PM
Last Post: deanhystad
  Tkinter GUI question texan1836 3 1,888 Apr-13-2023, 03:12 AM
Last Post: deanhystad
  simple tkinter question function call not opening image gr3yali3n 5 3,424 Aug-02-2022, 09:13 PM
Last Post: woooee
  How a QMainWindow can open a dialog? panoss 4 3,536 Feb-03-2022, 04:33 PM
Last Post: panoss
  [Tkinter] cancelling open dialog gives empty string rwahdan 2 3,375 Jul-17-2021, 09:17 PM
Last Post: steve_shambles
  Python tkinter question tablet Nick_tkinter 8 4,990 Mar-04-2021, 10:44 PM
Last Post: Larz60+
  tkinter slider question Nick_tkinter 1 2,487 Feb-22-2021, 01:31 PM
Last Post: deanhystad
  [Tkinter] Noob question:Using pyttsx3 with tkinter causes program to stop and close, any ideas? Osman_P 4 5,287 Nov-14-2020, 10:51 AM
Last Post: Osman_P
  question on tkinter canvas PhotoImage gr3yali3n 1 2,125 Sep-05-2020, 12:18 PM
Last Post: Larz60+
  Tkinter parameter question DPaul 2 2,066 Mar-14-2020, 09:35 AM
Last Post: DPaul

Forum Jump:

User Panel Messages

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