daily pastebin goal
41%
SHARE
TWEET

num gen

byFaiLx Nov 6th, 2014 (edited) 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Lottery Generator
  2.  
  3. #import modules for creating a GUI...
  4. import tkinter
  5. #...and for picking random numbers.
  6. import random
  7.  
  8.  
  9. nums = []
  10. #gens numbers
  11. def generate_num():
  12.     nums = []
  13.     balls = [i for i in range(1,50)]
  14.     random.shuffle(balls)
  15.     nums = balls[:6]
  16. #a function that will pick (and display) a name.
  17. def pickNum():
  18.     nameLabel.configure(text=random.choice(numbers))
  19.  
  20. #combines functions???
  21. def combine_funcs(*funcs):
  22.     def combined_func(*generate_num, **pickNum):
  23.         for f in funcs:
  24.             f(*generate_num, **pickNum)
  25.     return combined_func
  26.  
  27.  
  28.  
  29.  
  30. #the possible numbers.
  31. numbers = [nums]
  32.  
  33.  
  34.  
  35. #create a GUI window.
  36. root = tkinter.Tk()
  37. #set the title.
  38. root.title("Lottery Generator")
  39. #set the size.
  40. root.geometry("400x100")
  41.  
  42. #add a label for displaying the numbers.
  43. nameLabel = tkinter.Label(root, text="", font=('Helvetica', 32))
  44. nameLabel.pack()
  45.  
  46. #add a 'generate' button
  47. pickButton = tkinter.Button(text="generate",command=combined_func)
  48. pickButton.pack()
  49.  
  50. #start the GUI
  51. root.mainloop()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top