Example #1
0
def add_element():
    grid = Grid(cols=2)
    grid.append(Text(text_input.content))
    button = Button(text='x')
    grid.append(button)
    button.on_click(grid.delete)
    text_input.content = ''
    root.append(grid)
Example #2
0
def change_text():
    global text2
    global root_right
    root_right.delete()

    text2.content = select_list.selected
    text2.content[0].upper()
    stt = data_dir[text2.content]
    stt = str(stt).zfill(3)
    current_dir = pathlib.Path(__file__).parent
    image_path = current_dir / 'image_pokemon/{}.png'.format(stt)

    root_right = Grid(cols=2)
    text2 = Text(info_number(stt))
    root_right.append(Image(str(image_path)))
    root_right.append(text2)
    root.append(root_right)
Example #3
0
from gzuro import Grid, Text

root = Grid(cols=2)
hello = Text('Hello')
world = Text('World!')
root.append(hello)
root.append(world)
root.run()
Example #4
0
import pathlib
from gzuro import Grid, Image

current_dir = pathlib.Path(__file__).parent
image_path = current_dir / 'shiba.jpg'
root = Grid(cols=1)
root.append(Image(str(image_path)))
root.run()
Example #5
0
from gzuro import Grid, TextInput, Text, Button

root = Grid(cols=1)
text_input = TextInput()
root.append(text_input)


@text_input.on_submit
def add_element():
    grid = Grid(cols=2)
    grid.append(Text(text_input.content))
    button = Button(text='x')
    grid.append(button)
    button.on_click(grid.delete)
    text_input.content = ''
    root.append(grid)

root.run()
Example #6
0
from gzuro import Grid, Text, Button

root = Grid(cols=2)
button = Button(text='Click me')
text = Text('Not clicked')


@button.on_click
def change_text():
    text.content = 'clicked'


root.append(button)
root.append(text)
root.run()
Example #7
0
    for i in range(1, 152):
        with open('inform_pokemon/{}'.format(str(i).zfill(3))) as f:
            data_namelist.append(f.readline().rstrip())
    return data_namelist


def search_name(string):
    list = data_name()
    name = []
    for i in list:
        if i.lower().startswith(string.lower()):
            name.append(i)
    return name


root = Grid(cols=2)
root_left = Grid(rows=2)
root_right = Grid(cols=2)

current_dir = pathlib.Path(__file__).parent
image_path = 'image_pokemon/001.png'
root_right.append(Image(str(image_path)))
text2 = Text(info_number(1))
root_right.append(text2)
text_input = TextInput()
select_list = SelectList(choices=data_name(), default=data_name()[0])

# cho ra duoc dic cua pokemon  = {"ten": stt}


@text_input.on_change
Example #8
0
from gzuro import Grid, SelectList, Text

root = Grid(cols=2)
select_list = SelectList(choices=['blue', 'black', 'grey'], default='blue')
text = Text('Selected: blue')
root.append(select_list)
root.append(text)


@select_list.on_selection
def change_text():
    text.content = f'Selected: {select_list.selected}'


root.run()