Example #1
0
    def setupComponents(self, parent, deadChar):
        self.size = CHARACTERSLOTSIZE

        self.cImg = CharacterImage(position=(self.width / 4 - 39 / 4, 9))
        self.cImg.setupComponents()
        self.add(self.cImg)
        self.setItemImage(deadChar[1])
        self.deadChar = deadChar

        t = deadChar[0]
        if len(t) > 10:
            t = t[:8] + "..."
        l = Label(text=t)
        l.position = (self.width / 2 - l.width / 2, 0)
        self.add(l)

        btn = Button(title="Revive", action=self.imageClicked, style='default')
        btn.position = (self.width / 2 - btn.width / 2, 59)
        self.add(btn)
Example #2
0
	def setupComponents(self, parent, deadChar):
		self.size = CHARACTERSLOTSIZE
		
		self.cImg = CharacterImage(position = (self.width / 4 - 39 / 4, 9))
		self.cImg.setupComponents()
		self.add(self.cImg)
		self.setItemImage(deadChar[1])
		self.deadChar = deadChar
		
		t = deadChar[0]
		if len(t) > 10:
			t = t[:8] + "..."
		l = Label(text=t)
		l.position = (self.width / 2 - l.width / 2, 0)
		self.add(l)
		
		btn = Button(title = "Revive", action = self.imageClicked, style = 'default')
		btn.position = (self.width / 2 - btn.width / 2, 59)
		self.add(btn)
Example #3
0
        if c == '\r':
            print "Default"
        elif c == '\x1b':
            print "Cancel"
        else:
            Window.key_down(self, event)


class TestTextField(TextField):
    def __init__(self, number, *args, **kwds):
        TextField.__init__(self, *args, **kwds)
        self.number = number


nimiLabel = Label("Nimi:")
nimiLabel.position = (20, 20)

grp = RadioGroup()


def set_to_1():
    grp.value = 4


def make_window():
    global win_num
    global tiedot
    nimi = ""
    win_num += 1
    win = TestWindow(size=(320, 200), title="Text fields %d" % (win_num))
    win.tf1 = TestTextField(1,
Example #4
0
class TestWindow(Window):

	def do_default_action(self):
		process_input()

	def do_cancel_action(self):
		say("Cancel")

	def mouse_down(self, event):
		print 'mouse down!'

# experiment with TestWindow sizes
# experiment with TextField sizes

def make_window():
	global label
	win = TestWindow(size=(700, 50), title = "Universal Window")
	win.tf1 = TextField(position = (10, 10), width = 650)
	win.tf1.text = 'poopari'
	win.add(win.tf1)
	win.add(label)
	win.tf1.become_target()
	win.show()
	return win

label = Label(text = 'no mode selected ', color = red, just = 'center')
label.position = (8,32)
win = make_window()
application().run()