Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
lst = etk.List(model=model, selectable=False, animated_changes=False,
row_height=150, columns=[
#(100, ImageRenderer(file_slot=0), False),
(200, ktr, True),
(175, mir, False),
])
lst.freeze()
for i in range(50):
model.append(["07-image/icon.png", "User #%d" % i, 0])
lst.thaw()
# Main
box = etk.VBox()
box.append(lst, etk.VBox.START, etk.VBox.EXPAND_FILL, 0)
w = etk.Window(title="Hello World", child=box)
w.on_destroyed(lambda x: etk.main_quit())
w.show_all()
etk.main()
def stepper(bar, sli):
f = bar.fraction
if math.fabs(f - sli.value) < 0.01:
return True
if f < sli.value:
f += 0.005
else:
f -= 0.005
bar.fraction = f
return True
ecore.timer_add(0.02, stepper, my_bar, my_slider)
box = etk.VBox()
box.append(my_bar, etk.VBox.START, etk.VBox.FILL, 0)
box.append(my_slider, etk.VBox.END, etk.VBox.FILL, 0)
w = etk.Window(title="Hello World", size_request=(300, 100), child=box)
w.on_destroyed(lambda x: etk.main_quit())
w.show_all()
etk.main()
# File chooser
filechooser = etk.FilechooserWidget()
# Dialog
dialog = etk.Dialog(title="FilechooserWidget Test Python-Etk")
# Check boxes
select_multiple = etk.CheckButton (label="Select Multiple")
show_hidden = etk.CheckButton (label="Show hidden")
is_save = etk.CheckButton (label="Is save")
# Place the elements into the dialog
dialog.pack_in_main_area (filechooser, etk.VBox.START, etk.VBox.EXPAND_FILL, 0)
dialog.pack_widget_in_action_area(select_multiple, etk.VBox.START, etk.VBox.NONE, 0)
dialog.pack_widget_in_action_area(show_hidden, etk.VBox.START, etk.VBox.NONE, 0)
dialog.pack_widget_in_action_area(is_save, etk.VBox.START, etk.VBox.NONE, 0)
open = dialog.button_add_from_stock(etk.c_etk.StockEnums.DOCUMENT_OPEN, 1)
close = dialog.button_add_from_stock(etk.c_etk.StockEnums.DIALOG_CLOSE, 2)
# Events catchers
select_multiple.connect("toggled", chk_btns, "multiple")
show_hidden.connect("toggled", chk_btns, "hidden")
is_save.connect("toggled", chk_btns, "save")
open.connect("clicked", print_selected)
close.connect("clicked", lambda x: etk.main_quit())
dialog.on_destroyed(lambda x: etk.main_quit())
dialog.show_all()
etk.main()
global counter
counter += 1
x = etk.Button(label="Yet another button #%d" % counter)
box.append(x, etk.VBox.START, etk.VBox.FILL, 0)
x.show()
outer_box = etk.VBox()
box = etk.VBox()
adder = etk.Button(label="New Button")
adder.on_clicked(do_add, box)
sv = etk.ScrolledView()
sv.add_with_viewport(box)
outer_box.append(adder, etk.VBox.START, etk.VBox.FILL, 0)
outer_box.append(sv, etk.VBox.START, etk.VBox.EXPAND_FILL, 0)
w = etk.Window(title="Hello World", size_request=(200, 400), child=outer_box)
w.on_destroyed(lambda x: etk.main_quit())
w.show_all()
etk.main()
# ComboboxEntry
ce = etk.ComboboxEntry()
for t in ["Alpha", "Beta", "Gamma"]:
ce.item_append(t)
def show_active_item(c):
print c.active_item.field_get(0)
ce.on_active_item_changed(show_active_item)
# Main
box = etk.VBox()
box.append(combo, etk.VBox.START, etk.VBox.FILL, 0)
box.append(ce, etk.VBox.END, etk.VBox.FILL, 0)
w = etk.Window(title="Hello World", size_request=(300, 200), child=box)
w.on_destroyed(lambda x: etk.main_quit())
w.show_all()
etk.main()
if data == "save":
filechooser.is_save_set(obj.active_get())
# File chooser
filechooser = etk.FilechooserWidget()
# Dialog
dialog = etk.Dialog(title="FilechooserWidget Test Python-Etk")
# Check boxes
select_multiple = etk.CheckButton (label="Select Multiple")
show_hidden = etk.CheckButton (label="Show hidden")
is_save = etk.CheckButton (label="Is save")
# Place the elements into the dialog
dialog.pack_in_main_area (filechooser, etk.VBox.START, etk.VBox.EXPAND_FILL, 0)
dialog.pack_widget_in_action_area(select_multiple, etk.VBox.START, etk.VBox.NONE, 0)
dialog.pack_widget_in_action_area(show_hidden, etk.VBox.START, etk.VBox.NONE, 0)
dialog.pack_widget_in_action_area(is_save, etk.VBox.START, etk.VBox.NONE, 0)
open = dialog.button_add_from_stock(etk.c_etk.StockEnums.DOCUMENT_OPEN, 1)
close = dialog.button_add_from_stock(etk.c_etk.StockEnums.DIALOG_CLOSE, 2)
# Events catchers
select_multiple.connect("toggled", chk_btns, "multiple")
show_hidden.connect("toggled", chk_btns, "hidden")
is_save.connect("toggled", chk_btns, "save")
open.connect("clicked", print_selected)
close.connect("clicked", lambda x: etk.main_quit())
dialog.on_destroyed(lambda x: etk.main_quit())
dialog.show_all()