this is a german Web-Mirror of PYTHON.ORG powered by Domainunion AG

Attachment 'lecture4_buttonc.py'

Download

   1 #!/usr/bin/python               
   2                             #Souce section   1
   3 
   4 #mandatory for unix and linux
   5 #---------------------------------------------------------------
   6 
   7 from Tkinter import *       #This library give us windows and buttons
   8 from random import *        #This library allows us to generate random numbers
   9                             #import library section   2
  10 
  11 #
  12 #What not to use??? 
  13 #---------------------------------------------------------------
  14 
  15 def one_to_ten():
  16     ran = uniform(1,10)
  17     print ran
  18     
  19 def GoWork():           # def starts a function, or define a function
  20     sum = 3*5 
  21     print sum               #Function section   3 
  22 	
  23 #----------------------------------------------------------------
  24 
  25 
  26 	
  27                             #Code section    4
  28     
  29 window = Tk()      #i am the parent, button = child
  30 
  31 stacy = Button(window, text = 'yoyo', command = one_to_ten)  
  32 #A rose with any other name would be just as sweet
  33 
  34 
  35 stacy.pack()        #you can name it after your fish (ignored)
  36 window.mainloop()         #youcan use your fish's name 

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2005-04-27 13:13:02, 0.6 KB) [[attachment:Lecture3_example1.py]]
  • [get | view] (2005-04-27 13:52:38, 0.7 KB) [[attachment:Lecture3_example2.py]]
  • [get | view] (2005-04-29 14:35:01, 767.5 KB) [[attachment:lecture10_pictures.py]]
  • [get | view] (2008-06-27 13:22:12, 0.0 KB) [[attachment:lecture3example1.txt]]
  • [get | view] (2005-04-28 00:44:04, 0.2 KB) [[attachment:lecture4_but.py]]
  • [get | view] (2005-04-28 00:44:35, 0.3 KB) [[attachment:lecture4_button.py]]
  • [get | view] (2005-04-28 00:44:22, 1.1 KB) [[attachment:lecture4_buttonc.py]]
  • [get | view] (2005-04-28 00:46:20, 0.4 KB) [[attachment:lecture4_first.py]]
  • [get | view] (2005-04-28 00:46:55, 0.5 KB) [[attachment:lecture4_homework.py]]
  • [get | view] (2005-04-28 00:47:56, 0.1 KB) [[attachment:lecture5_chieh.py]]
  • [get | view] (2005-04-28 00:48:10, 0.1 KB) [[attachment:lecture5_stacy.py]]
  • [get | view] (2005-04-28 00:49:57, 0.2 KB) [[attachment:lecture6_chieh.py]]
  • [get | view] (2005-04-28 00:49:43, 0.3 KB) [[attachment:lecture6_stacy.py]]
  • [get | view] (2005-04-28 00:51:59, 0.5 KB) [[attachment:lecture7_homework.py]]
  • [get | view] (2005-04-28 00:51:45, 0.4 KB) [[attachment:lecture7_text.py]]
  • [get | view] (2005-04-29 14:32:06, 0.5 KB) [[attachment:lecture8_ifexample.py]]
  • [get | view] (2005-04-29 14:34:05, 0.5 KB) [[attachment:lecture9_password.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.

Unable to edit the page? See the FrontPage for instructions.