Hi can anyone help me i am using python 3
and i am new here.
I want to know how i can make these random numbers, example: 4 11 17 21 44 - 20
show up, like the example. The problem is the last #20 shows up below the others.
as you can see if you run the code
thanks for any help.

import sys, random, tkinter

# sample items without replacement
L = list(range(1,60))
random.shuffle(L)


g = L[:5]
g.sort()
f = L[5:6]



print(' '.join(str(G) for G in g),'    ',f[0])

app=tkinter.Tk()
app.geometry('700x400+420+420')
app.title(string="       LOTTO       ")


label5=tkinter.Label(app,text = g ).pack(padx=16,pady=30)
label5=tkinter.Label (app,text=f).pack(padx=0,pady=30)

tkinter.Button(text="Exit",fg="brown",bg="cyan" ,command=sys.exit).pack()

tkinter.mainloop()
app.mainloop()

Recommended Answers

All 3 Replies

Hi! Welcome to daniweb and the python forum!

You can use a single Label

import sys, random, tkinter

# sample items without replacement
L = list(range(1,60))
random.shuffle(L)


g = L[:5]
g.sort()
f = L[5:6]


drawing = ''.join([' '.join(str(G) for G in g),'    ',str(f[0])])
print(drawing)

app=tkinter.Tk()
app.geometry('700x400+420+420')
app.title(string="       LOTTO       ")


label5=tkinter.Label(app,text = drawing ).pack(padx=16,pady=30)
#label5=tkinter.Label (app,text=f).pack(padx=0,pady=30)

tkinter.Button(text="Exit",fg="brown",bg="cyan" ,command=sys.exit).pack()

tkinter.mainloop()
app.mainloop()

ok Thanks I never heard of drawing in python
so drawing is a variable and not part of python?

so drawing is a variable and not part of python?

Yes, it is a variable name. I'm not sure it is well chosen as english is not my first language.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.