Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
894 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 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...