Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
main_vbox = etk.VBox(False, 3)
## Create notebook and add pages
notebook = etk.Notebook()
main_vbox.append(notebook, etk.HBox.START, etk.HBox.EXPAND_FILL, 0)
notebook.page_append("First Tab", table)
notebook.page_append("Second Tab", align)
## Create the prev/next buttons and the "Hide tabs" toggle button
hbox = etk.HBox(True, 0)
main_vbox.append(hbox, etk.VBox.START, etk.VBox.SHRINK_OPPOSITE, 0)
button = etk.Button(label="Previous")
button.set_from_stock(etk.c_etk.StockEnums.GO_PREVIOUS)
button.on_clicked(prev_cb, notebook)
hbox.append(button, etk.HBox.START, etk.HBox.FILL, 0)
button = etk.Button(label="Next")
button.set_from_stock(etk.c_etk.StockEnums.GO_NEXT)
button.on_clicked(next_cb, notebook)
hbox.append(button, etk.HBox.START, etk.HBox.FILL, 0)
button = etk.ToggleButton(label="Hide tabs")
button.on_toggled(hide_tabs_toggled_cb, notebook)
hbox.append(button, etk.HBox.START, etk.HBox.FILL, 0)
w = etk.Window(title="Etk Notebook Example", size_request=(300, 300), child=main_vbox)
w.show_all()
def on_destroyed(obj):
etk.main_quit()
w.connect("destroyed", on_destroyed)
make_button("Remove last", remove, lst, -1)
def remove_selected(b, l):
rows = l.selected_rows
if rows:
l.model.remove(rows[0])
return True
make_button("Remove selected", remove_selected, lst)
bsbox = etk.VBox()
for b in bs:
bsbox.append(b, etk.VBox.START, etk.VBox.FILL, 0)
# Main
box = etk.HBox()
box.append(bsbox, etk.HBox.START, etk.HBox.FILL, 0)
box.append(lst, etk.HBox.START, etk.HBox.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 remove_selected(b, l):
rows = l.selected_rows
if rows:
l.model.remove(rows[0])
return True
make_button("Remove selected", remove_selected, lst)
bsbox = etk.VBox()
for b in bs:
bsbox.append(b, etk.VBox.START, etk.VBox.FILL, 0)
# Main
box = etk.HBox()
box.append(bsbox, etk.HBox.START, etk.HBox.FILL, 0)
box.append(lst, etk.HBox.START, etk.HBox.EXPAND_FILL, 0)
w = etk.Window(title="Hello World", child=box)
w.on_destroyed(lambda x: etk.main_quit())
w.show_all()
etk.main()
import etk
v = etk.VPaned()
h = etk.HBox()
out_tv = etk.TextView()
in_tv = etk.TextView()
out_tb = out_tv.textblock_get()
in_tb = in_tv.textblock_get()
iter_out = etk.TextblockIter(out_tb)
iter_out.forward_end()
b = etk.Button(label="Send")
#e = etk.Entry()
h.append(in_tv, etk.HBox.START, etk.HBox.EXPAND_FILL, 0)
#h.append(e, etk.HBox.START, etk.HBox.EXPAND_FILL, 0)
h.append(b, etk.HBox.END, etk.HBox.FILL, 0)
def prev_cb(obj, note):
note.page_prev()
def next_cb(obj, note):
note.page_next()
def hide_tabs_toggled_cb(obj, note):
note.tabs_visible_set(not obj.active_get())
##############
## Main Window
main_vbox = etk.VBox(False, 3)
## Create notebook and add pages
notebook = etk.Notebook()
main_vbox.append(notebook, etk.HBox.START, etk.HBox.EXPAND_FILL, 0)
notebook.page_append("First Tab", table)
notebook.page_append("Second Tab", align)
## Create the prev/next buttons and the "Hide tabs" toggle button
hbox = etk.HBox(True, 0)
main_vbox.append(hbox, etk.VBox.START, etk.VBox.SHRINK_OPPOSITE, 0)
button = etk.Button(label="Previous")
button.set_from_stock(etk.c_etk.StockEnums.GO_PREVIOUS)
button.on_clicked(prev_cb, notebook)
hbox.append(button, etk.HBox.START, etk.HBox.FILL, 0)
button = etk.Button(label="Next")
button.set_from_stock(etk.c_etk.StockEnums.GO_NEXT)
button.on_clicked(next_cb, notebook)
hbox.append(button, etk.HBox.START, etk.HBox.FILL, 0)
v = etk.VPaned()
h = etk.HBox()
out_tv = etk.TextView()
in_tv = etk.TextView()
out_tb = out_tv.textblock_get()
in_tb = in_tv.textblock_get()
iter_out = etk.TextblockIter(out_tb)
iter_out.forward_end()
b = etk.Button(label="Send")
#e = etk.Entry()
h.append(in_tv, etk.HBox.START, etk.HBox.EXPAND_FILL, 0)
#h.append(e, etk.HBox.START, etk.HBox.EXPAND_FILL, 0)
h.append(b, etk.HBox.END, etk.HBox.FILL, 0)
w = etk.Window(title="Testing TextView!", child=v)
v.child2_set(h,1)
v.child1_set(out_tv,1)
def sendButton_cb(button):
text = in_tb.text_get(0)
in_tb.clear()
#text = e.text
#e.text = ""
print text
out_tb.insert(iter_out, text)
b.on_clicked(sendButton_cb)
def hide_tabs_toggled_cb(obj, note):
note.tabs_visible_set(not obj.active_get())
##############
## Main Window
main_vbox = etk.VBox(False, 3)
## Create notebook and add pages
notebook = etk.Notebook()
main_vbox.append(notebook, etk.HBox.START, etk.HBox.EXPAND_FILL, 0)
notebook.page_append("First Tab", table)
notebook.page_append("Second Tab", align)
## Create the prev/next buttons and the "Hide tabs" toggle button
hbox = etk.HBox(True, 0)
main_vbox.append(hbox, etk.VBox.START, etk.VBox.SHRINK_OPPOSITE, 0)
button = etk.Button(label="Previous")
button.set_from_stock(etk.c_etk.StockEnums.GO_PREVIOUS)
button.on_clicked(prev_cb, notebook)
hbox.append(button, etk.HBox.START, etk.HBox.FILL, 0)
button = etk.Button(label="Next")
button.set_from_stock(etk.c_etk.StockEnums.GO_NEXT)
button.on_clicked(next_cb, notebook)
hbox.append(button, etk.HBox.START, etk.HBox.FILL, 0)
button = etk.ToggleButton(label="Hide tabs")
button.on_toggled(hide_tabs_toggled_cb, notebook)
hbox.append(button, etk.HBox.START, etk.HBox.FILL, 0)