Page 1 of 1

python GUI: lottery generator

Posted: Thu Nov 06, 2014 9:00 pm
by byfailx
lottery generator with GUI in python 3.3,
need to combine two functions don't really know how,
help?, please

here is the code

http://pastebin.com/WS1hvJe8

...

Code: Select all

#Lottery Generator
 
#import modules for creating a GUI...
import tkinter
#...and for picking random numbers.
import random
 
 
nums = []
#gens numbers
def generate_num():
    nums = []
    *** = [i for i in range(1,50)]
    random.shuffle(***)
    nums = ***[:6]
#a function that will pick (and display) a name.
def pickNum():
    nameLabel.configure(text=random.choice(numbers))
 
#combines functions???
def combine_funcs(*funcs):
    def combined_func(*generate_num, **pickNum):
        for f in funcs:
            f(*generate_num, **pickNum)
    return combined_func
 
 
 
 
#the possible numbers.
numbers = [nums]
 
 
 
#create a GUI window.
root = tkinter.Tk()
#set the title.
root.title("Lottery Generator")
#set the size.
root.geometry("400x100")
 
#add a label for displaying the numbers.
nameLabel = tkinter.Label(root, text="", font=('Helvetica', 32))
nameLabel.pack()
 
#add a 'generate' button
pickButton = tkinter.Button(text="generate",command=combined_func)
pickButton.pack()
 
#start the GUI
root.mainloop()
thanks in advance

Re: python GUI: lottery generator

Posted: Wed Nov 12, 2014 9:54 pm
by Acid_Snake
What do you mean by combining two functions?

Re: python GUI: lottery generator

Posted: Wed Nov 12, 2014 10:54 pm
by Gilgamesh
What do you want it to do? Return a number from a randomly generated list?