Показать сообщение отдельно

  #42  
Старый 17.08.2008, 18:21
alextoun
Постоянный
Регистрация: 07.05.2006
Сообщений: 732
Провел на форуме:
7910701

Репутация: 811


По умолчанию

для теста 1-ое готово правдо на TK

Цитата:
#!/usr/bin/python
from Tkinter import *
import random

def rand():
mystring = ("A","B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", \
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", \
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", \
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", \
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", \
"!", "@", "#", "$", "%", "^", "&", "*",)
try:
num = int(entry.get())
except:
textbox.insert(END, "tsiframi \n\n")

r = ''.join(random.sample(mystring, num))
textbox.insert(END, r + "\n\n")

def clearit():
try:
textbox.delete(0.0, END)
except:
textbox.insert(END, "Unable to Clear\n\n")

def copy():
textbox.insert(END, "programed by alextoun \n\n")



root = Tk()
root.title("Test python 1")

frame = Frame(root)
entry = Entry(frame)
entry.pack(side=LEFT)
label = Label(frame, text="kol-vo simvolov")
label.pack(side=LEFT)
button = Button(frame, text="Generit", command=rand)
button.pack(side=LEFT)

button2 = Button(frame, text="Ochitit", command=clearit)
button2.pack(side=LEFT)

button3 = Button(frame, text="o proge", command=copy)
button3.pack(side=LEFT)

frame.pack()
frame2 = Frame(root)
textbox = Text(frame2)
textbox.pack(side=LEFT, fill=BOTH, expand=TRUE)
frame2.pack(expand=TRUE, fill=BOTH)
root.mainloop()
можно конечно наманооого проще, и тупее прогу сделать
 
Ответить с цитированием