0xC0DEBA5E

Recent Entries

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()

Paste below

Title
Code
Language
To verify that you're not an automated script, please type the word human below in ALL CAPITALS
Word