Recent Entries
- (no title) 2009/11/11 21:19
- (no title) 2009/11/11 21:19
- rng 2009/10/29 16:13
- fsdfsdfds 2009/10/29 10:11
- jwin demo 2009/10/29 10:09
- sdc 2009/09/24 17:04
- empty 2009/08/28 07:44
- testingtest 2009/07/15 14:36
- java2 2009/06/25 13:42
- (no title) 2009/06/22 02:28
Welcome to Code Base
This is a google app engine powered pastebin. Unfortunately the autodetect doesn't appear to be too good at recognizing python code - I'll work on it. For further questions, please use the contact form.
jwin demo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | from jwin.widgets import Window, StaticText, Text, Button
from jwin.layouts import GridLayout
from jwin.app import JWin
class Demo(object):
def __init__(self):
self.i = 0
def click(self):
self.win2.append(StaticText(self.tk, "Click %d - %s!" % (self.i, self.text.value)))
self.text.value = ""
self.i += 1
def run(self, tk):
self.tk = tk
self.win1 = Window(tk, "Button window")
self.win1.setLayout(GridLayout(rows=1, cols=3))
self.win2 = Window(tk, "Message window")
tk.root().append(self.win1)
tk.root().append(self.win2)
self.text = Text(tk)
button = Button(tk, "Hello")
button.click = self.click
self.win1.append(StaticText(tk, "Enter some data"))
self.win1.append(self.text)
self.win1.append(button)
if __name__ == '__main__':
j = JWin(Demo)
j.start()
|