[Tkinter] import numbers into a list and print (gui python) - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [Tkinter] import numbers into a list and print (gui python) (/thread-4345.html) |
import numbers into a list and print (gui python) - kostasalgo - Aug-09-2017 How do I import numbers into a list in Python's graphic environment (gui of python) and how to print them through a button Thanks in advance RE: import numbers into a list and print (gui python) - nilamo - Aug-09-2017 Which graphics toolkit? tk? gtk? qt? wx? Something else? RE: import numbers into a list and print (gui python) - kostasalgo - Aug-09-2017 (Aug-09-2017, 06:54 PM)nilamo Wrote: Which graphics toolkit? tk? gtk? qt? wx? Something else? graphics toolkit Tk RE: import numbers into a list and print (gui python) - nilamo - Aug-09-2017 What do you have so far? What errors are you getting? RE: import numbers into a list and print (gui python) - kostasalgo - Aug-09-2017 (Aug-09-2017, 07:16 PM)nilamo Wrote: What do you have so far? What errors are you getting? I do not have any errors in code I ask for an basic example to create it at the beginning (Aug-09-2017, 07:48 PM)kostasalgo Wrote: [quote='nilamo' pid='22586' dateline='1502306181'] I do not have any errors in code I ask for an basic example to create it at the beginning example Ab=[] for i in range(3): Ab.append(input('Give a num=')) print (Ab) RE: import numbers into a list and print (gui python) - nilamo - Aug-09-2017 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() |