Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

tkinter - In python tk inter module, I want to print multiple results

import random as rd

def lottery_number():
    num = int(number.get())
    for i in range(num):
        lotto_list = list(range(1,46))   #from 1 to 45
        rd.shuffle(lotto_list) #shuffle
        lotto_list1 = lotto_list[:6]  
        lotto_list1.sort() #sorting 
        answer = '{}  Auto'.format(i), lotto_list1
    result.config(text=answer)

from tkinter import *

window = Tk()
label = Label(window, text = 'press lottery game number.')
label.pack()

number =Entry(window, width = 30)
number.pack()

btn = Button(window, text = 'Click', fg = 'blue', command = lottery_number)
btn.pack()

result = Label(window, text = 'Result')
result.pack()

window.mainloop()

the result is just one. for example, {1} Auto 3, 5, 9, 30 ,33

I want print multiple results like below

                          {1} Auto 3, 5, 9, 30 ,33
                          {2} Auto 4, 6, 9, 23 ,44
                          {3} Auto 1, 7, 9, 20 ,26

thanks .

Actually, I want print like this below

                      {A} Auto 3, 5, 9, 30 ,33
                      {B} Auto 4, 6, 9, 23 ,44
                      {C} Auto 1, 7, 9, 20 ,26
question from:https://stackoverflow.com/questions/65860332/in-python-tk-inter-module-i-want-to-print-multiple-results

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...