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
Post Reply
byfailx
Posts: 3
Joined: Wed Apr 30, 2014 7:46 pm

python GUI: lottery generator

Post by byfailx » Thu Nov 06, 2014 9:00 pm

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
[spoiler]Image[/spoiler]

User avatar
Acid_Snake
Retired Mod
Posts: 3099
Joined: Tue May 01, 2012 11:32 am
Location: Behind you!

Re: python GUI: lottery generator

Post by Acid_Snake » Wed Nov 12, 2014 9:54 pm

What do you mean by combining two functions?
Advertising

User avatar
Gilgamesh
Posts: 54
Joined: Mon Apr 16, 2012 4:59 pm
Location: Hawaii

Re: python GUI: lottery generator

Post by Gilgamesh » Wed Nov 12, 2014 10:54 pm

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

Post Reply

Return to “Programming”