Advertising (This ad goes away for registered users. You can Login or Register)

python GUI: lottery generator

Programming on your favorite platform, for your favorite platform? Post here
Locked
byfailx
Posts: 3
Joined: Wed Apr 30, 2014 7:46 pm

python GUI: lottery generator

Post 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
Advertising
Last edited by fate6 on Thu Nov 06, 2014 9:38 pm, edited 1 time in total.
Reason: Moved to PC/Programming
Acid_Snake
Retired Mod
Posts: 3100
Joined: Tue May 01, 2012 11:32 am
Location: Behind you!

Re: python GUI: lottery generator

Post by Acid_Snake »

What do you mean by combining two functions?
Advertising
Gilgamesh
Posts: 52
Joined: Mon Apr 16, 2012 4:59 pm
Location: Hawaii

Re: python GUI: lottery generator

Post by Gilgamesh »

What do you want it to do? Return a number from a randomly generated list?
"The sidekick is NOT to ditch the hero!"
Locked

Return to “Programming”