Python Forum
[Tkinter] import numbers into a list and print (gui python)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] import numbers into a list and print (gui python)
#6
I'm not sure what importing a list of numbers means, but here's a simple example of how to have a click handler attached to a button:
import tkinter as tk


class Items:
    def __init__(self, data):
        self.data = data

    def click(self):
        print(self.data)


root = tk.Tk()
things = Items(["spam", "eggs"])
button = tk.Button(root, text="Print the things", command=things.click)
button.pack()
root.mainloop()
Reply


Messages In This Thread
RE: import numbers into a list and print (gui python) - by nilamo - Aug-09-2017, 08:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] How to Print a list = ['a','b','c'], using tkinter along with a custom font? Pleiades 2 2,392 Sep-15-2020, 03:54 PM
Last Post: Pleiades

Forum Jump:

User Panel Messages

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