def __init__(self, args=False): win = self.win = elm.StandardWindow("ewin", "eWin") win.callback_delete_request_add(lambda o: elm.exit()) vbox = self.vbox = elm.Box(win) vbox.size_hint_align_set(-1.0, -1.0) vbox.size_hint_weight_set(1.0, 1.0) vbox.show() self.probe_create() bt = elm.Button(win) bt.text = "Refresh" bt.size_hint_weight_set(1.0, 0.0) bt.size_hint_align_set(-1.0, -1.0) bt.callback_clicked_add(lambda o: self.gl(True)) vbox.pack_end(bt) bt.show() bt = elm.Button(win) bt.text = "Quit" bt.size_hint_weight_set(1.0, 0.0) bt.size_hint_align_set(-1.0, -1.0) bt.callback_clicked_add(lambda o: elm.exit()) vbox.pack_end(bt) bt.show() win.resize_object_add(vbox) win.resize(450, 350) win.show()
def destroy(obj, *args, **kargs): try: self.pressureLabelTimer.delete() self.altitudeLabelTimer.delete() self.pressureGraphTimer.delete() self.SaveConfig(self.configfile) except: print "Exception occured on exit" elementary.exit()
def close_nolook(Junk,window1,textbox1): if not os.path.exists(os.path.expanduser('~')+"/.e/e/applications/Etext/settings"): os.makedirs(os.path.expanduser('~')+"/.e/e/applications/Etext/") else: os.remove(os.path.expanduser('~')+"/.e/e/applications/Etext/settings") f = open(os.path.expanduser('~')+"/.e/e/applications/Etext/settings",'w') global style f.write(style) elementary.exit()
def close_nolook(Junk, window1, textbox1): if not os.path.exists( os.path.expanduser('~') + "/.e/e/applications/Etext/settings"): os.makedirs(os.path.expanduser('~') + "/.e/e/applications/Etext/") else: os.remove( os.path.expanduser('~') + "/.e/e/applications/Etext/settings") f = open( os.path.expanduser('~') + "/.e/e/applications/Etext/settings", 'w') global style f.write(style) elementary.exit()
def real_checks(btn, pkg_info_en): try: breaks = deb.check_breaks_existing_packages() if breaks != True: pkg_info_en.entry_set("<b>WARNING:</> Installing this package will break certain existing packages.<ps><ps><ps>%s"%breaks) elif deb.check_conflicts() != True: pkg_info_en.entry_set("<b>WARNING:</> There are conflicting packages.") pkg_info_en.entry_append("<ps> %s" %deb.conflicts) else: pkg_info_en.entry_set("<b>CLEAR:</> You are cleared to go. The selected file has passed <b>ALL</> checks.") btn.disabled_set(False) except: print("eDeb Critical Error: Virtual group issue.\nExiting...") elm.exit() quit()
def ctxpopup_clicked(obj): win = elementary.Window("ctxpopup", elementary.ELM_WIN_BASIC) win.title = "Context popup test" win.autodel = True if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() li = elementary.List(win) win.resize_object_add(li) li.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) li.mode = elementary.ELM_LIST_COMPRESS li.show() li.item_append("Ctxpopup with icons and labels", callback=cb_item1) li.item_append("Ctxpopup with icons only", callback=cb_item2) li.item_append("Ctxpopup with labels only", callback=cb_item3) li.item_append("Ctxpopup at horizontal mode", callback=cb_item4) li.item_append("Ctxpopup with user content", callback=cb_item5) li.item_append("Ctxpopup with restacking", callback=cb_item6) li.go() win.resize(400, 400) win.show()
def hello_elementary(): #Creates a "Standard" elementary window. The first argument is the name of our window. The second argument is the title displayed on the window bar window = elementary.StandardWindow("hello world", "Hello Elementary") #callback_delete_request_add tells our window what to do when it's "close" button is pressed window.callback_delete_request_add(lambda o: elementary.exit()) #Content for our window. Creates a "Label" object which display text in our window. Whenever we create an elementary object we must provide a parent window as input windytax = elementary.Label(window) #Tells our label object to change size based on the size of our window windytax.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) windytax.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) #Define what text our window should display windytax.text = '<b>Hello Elementary!</b>' #If we want to see our object we need to tell it to be shown windytax.show() #resize_object_add adds our Label object "windytax" to the window window.resize_object_add(windytax) #resize takes an ordered pair as input for the size for our window, the dimenions are pixel by pixel window.resize(300,300) #Finally lets tell our window object to show up just like we did with our label window.show()
def table_clicked(obj): win = elementary.Window("table", elementary.ELM_WIN_BASIC) win.title_set("Table") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() tb = elementary.Table(win) win.resize_object_add(tb) tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) tb.show() bt = elementary.Button(win) bt.text_set("Button 1") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 0, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Button 2") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 1, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Button 3") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 2, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Button 4") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 0, 1, 2, 1) bt.show() bt = elementary.Button(win) bt.text_set("Button 5") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 2, 1, 1, 3) bt.show() bt = elementary.Button(win) bt.text_set("Button 6") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 0, 2, 2, 2) bt.show() win.show()
def panel_clicked(obj): win = elementary.Window("panel", elementary.ELM_WIN_BASIC) win.title_set("Panel test") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() bx = elementary.Box(win) bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(bx) bx.show() panel = elementary.Panel(win) panel.orient = elementary.ELM_PANEL_ORIENT_LEFT panel.size_hint_weight_set(0.0, evas.EVAS_HINT_EXPAND); panel.size_hint_align_set(0.0, evas.EVAS_HINT_FILL); bt = elementary.Button(win) bt.text_set("HIDE ME :)") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND); bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL); bt.show() panel.content_set(bt) bx.pack_end(panel) panel.show() win.resize(300, 300) win.show()
def panel_clicked(obj): win = elementary.Window("panel", elementary.ELM_WIN_BASIC) win.title_set("Panel test") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() bx = elementary.Box(win) bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(bx) bx.show() panel = elementary.Panel(win) panel.orient = elementary.ELM_PANEL_ORIENT_LEFT panel.size_hint_weight_set(0.0, evas.EVAS_HINT_EXPAND) panel.size_hint_align_set(0.0, evas.EVAS_HINT_FILL) bt = elementary.Button(win) bt.text_set("HIDE ME :)") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bt.show() panel.content_set(bt) bx.pack_end(panel) panel.show() win.resize(300, 300) win.show()
def naviframe_clicked(obj): win = elementary.Window("naviframe", elementary.ELM_WIN_BASIC) win.title_set("Naviframe test") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.show() nf = elementary.Naviframe(win) win.resize_object_add(nf) nf.show() bt = elementary.Button(win) bt.callback_clicked_add(page2, nf) bt.text_set("Next") content = content_new(nf, "images/logo.png") item = nf.item_push("Page 1", None, bt, content, "basic") nf.data["page1"] = item win.resize(400, 600) win.show()
def inner_window_clicked(obj): win = elementary.Window("inner-window", elementary.ELM_WIN_BASIC) win.title_set("InnerWindow test") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() lb = elementary.Label(win) lb.text_set("This is an \"inwin\" - a window in a<br/>" "window. This is handy for quick popups<br/>" "you want centered, taking over the window<br/>" "until dismissed somehow. Unlike hovers they<br/>" "don't hover over their target.") iw = elementary.InnerWindow(win) iw.content_set(lb) iw.show() win.resize(320, 320) win.show()
def login_error(self, obj): win = elementary.Window("test", elementary.ELM_WIN_BASIC) win.title_set("eAndora - Error") if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() box0 = elementary.Box(win) box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(box0) box0.show() fr = elementary.Frame(win) fr.text_set("There was an issue logging - please try again.") box0.pack_end(fr) fr.show() bt = elementary.Button(win) bt.text_set("OK") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bt.callback_unpressed_add(self.spawn_login, win) box0.pack_end(bt) bt.show() win.show()
def menu_clicked(obj): win = elementary.Window("menu", elementary.ELM_WIN_BASIC) win.title_set("Menu test") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() rect = evas.Rectangle(win.evas_get()) win.resize_object_add(rect) rect.color_set(0, 0, 0, 0) rect.show() menu = elementary.Menu(win) item = menu.item_add(None, "first item", "clock") item = menu.item_add(None, "second item", "mail-send") menu_populate_1(menu, item) menu.item_add(item, "sub menu", "refresh") rect.event_callback_add(evas.EVAS_CALLBACK_MOUSE_DOWN, menu_show, menu) win.resize(350, 200) win.show()
def __init__( self, parent ): #builds a elementary box to accept login information elementary.Box.__init__(self, parent.mainWindow) eframe = elementary.Frame(parent.mainWindow) eframe.text_set("Email:") eframe.size_hint_weight_set(1, 1) eframe.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) eframe.show() log = elementary.Entry(parent.mainWindow) log.single_line = True log.input_panel_return_key_disabled_set(True) log.size_hint_weight_set(1, 1) log.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) eframe.content = log log.show() pframe = elementary.Frame(parent.mainWindow) pframe.text_set("Password:"******"Store Login") self.pack_end(ck) ck.show() pas = elementary.Entry(parent.mainWindow) pas.single_line = True pas.line_wrap_set(False) pas.password = True pas.input_panel_return_key_disabled = True pas.size_hint_weight_set(1, 1) pas.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) pframe.content = pas pas.show() lg = elementary.Button(parent.mainWindow) lg.text_set("Login") lg.size_hint_weight_set(.25, .25) lg.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) lg.callback_unpressed_add(parent.login_user, log, pas, parent.mainWindow, ck) lg.show() ex = elementary.Button(parent.mainWindow) ex.text_set("Exit") ex.size_hint_weight_set(.25, .25) ex.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) ex.callback_unpressed_add(lambda o: elementary.exit()) ex.show() self.pack_end(eframe) self.pack_end(pframe) self.pack_end(ck) self.pack_end(lg) self.pack_end(ex)
def clock_clicked(obj): win = elementary.Window("clock", elementary.ELM_WIN_BASIC) win.title_set("Clock") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() bx = elementary.Box(win) win.resize_object_add(bx) bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bx.show() ck = elementary.Clock(win) bx.pack_end(ck) ck.show() ck = elementary.Clock(win) ck.show_am_pm_set(True) bx.pack_end(ck) ck.show() print((ck.time_get())) ck = elementary.Clock(win) ck.show_seconds_set(True) bx.pack_end(ck) ck.show() ck = elementary.Clock(win) ck.show_seconds_set(True) ck.show_am_pm_set(True) bx.pack_end(ck) ck.show() ck = elementary.Clock(win) ck.edit_set(True) ck.show_seconds_set(True) ck.show_am_pm_set(True) ck.time_set(10, 11, 12) bx.pack_end(ck) ck.show() ck = elementary.Clock(win) ck.edit_set(True) ck.show_seconds_set(True) ck.edit_mode = elementary.ELM_CLOCK_EDIT_HOUR_DECIMAL | \ elementary.ELM_CLOCK_EDIT_MIN_DECIMAL | \ elementary.ELM_CLOCK_EDIT_SEC_DECIMAL bx.pack_end(ck) ck.show() win.show()
def dayselector_clicked(obj): win = elementary.Window("dayselector", elementary.ELM_WIN_BASIC) win.title = "Dayselector test" win.autodel = True if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() box = elementary.Box(win) box.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) box.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) win.resize_object_add(box) box.show() # default ds = elementary.Dayselector(win) ds.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) ds.size_hint_align = (evas.EVAS_HINT_FILL, 0.5) box.pack_end(ds) ds.show() ds.callback_dayselector_changed_add(cb_changed) # Sunday first ds = elementary.Dayselector(win) ds.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) ds.size_hint_align = (evas.EVAS_HINT_FILL, 0.5) box.pack_end(ds) ds.show() ds.callback_dayselector_changed_add(cb_changed) try: sunday = ds.part_content_get("day0") sunday.signal_emit("elm,type,weekend,style1", "") except: print("BUG HERE !!!") # Monday first ds = elementary.Dayselector(win) ds.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) ds.size_hint_align = (evas.EVAS_HINT_FILL, 0.5) ds.callback_dayselector_changed_add(cb_changed) box.pack_end(ds) ds.show() ds.week_start = elementary.ELM_DAY_MONDAY try: sunday = ds.part_content_get("day0") sunday.signal_emit("elm,type,weekend,style1", "") except: print("BUG HERE !!!") win.resize(350, 120) win.show()
def __init__(self): # Main window - where everything other than popups appears self.mainWindow = elementary.StandardWindow("eAndora", "eAndora - Internet Radio") self.nf = elementary.Naviframe(self.mainWindow) self.nf.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self.nf.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) self.nf.show() self.mainWindow.resize_object_add(self.nf) self.mainWindow.callback_delete_request_add(lambda o: elementary.exit()) # Our pandora interface instance self.ourPlayer = eAndora(self)
def buttons_clicked(obj): win = elementary.Window("buttons", elementary.ELM_WIN_BASIC) win.title_set("Buttons") win.focus_highlight_enabled_set(True) win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() bx = elementary.Box(win) win.resize_object_add(bx) bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bx.show() ic = elementary.Icon(win) ic.file_set("images/logo_small.png") ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1) bt = elementary.Button(win) bt.text_set("Icon sized to button") bt.content_set(ic) bx.pack_end(bt) bt.show() ic.show() ic = elementary.Icon(win) ic.file_set("images/logo_small.png") ic.resizable_set(0, 0) bt = elementary.Button(win) bt.text_set("Icon no scale") bt.content_set(ic) bx.pack_end(bt) bt.show() ic.show() bt = elementary.Button(win) bt.text_set("Button only") bx.pack_end(bt) bt.show() ic = elementary.Icon(win) ic.file_set("images/logo_small.png") ic.resizable_set(0, 0) bt = elementary.Button(win) bt.content_set(ic) bx.pack_end(bt) bt.show() ic.show() win.show()
def __init__( self ): self.mainWindow = elementary.StandardWindow("eCcess", "eCcess - System Tool") self.mainWindow.callback_delete_request_add(lambda o: elementary.exit()) self.nf = elementary.Naviframe(self.mainWindow) self.nf.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self.nf.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) #self.scroller = elementary.Scroller(self.mainWindow) #self.scroller.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_FILL) #self.scroller.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) #self.scroller.content_set(self.nf) #self.scroller.policy_set(0, 1) self.nf.show() self.mainWindow.resize_object_add(self.nf)
def add_wins(self, origin, mount, add=False, nodev=False): if add: data = {} data['device'] = origin data['path'] = mount data['name'] = add if os.path.exists('%s/Windows/System32/config/SAM'%mount): data['SAM'] = '%s/Windows/System32/config/SAM'%mount elif os.path.exists('%s/WINDOWS/system32/config/SAM'%mount): data['SAM'] = '%s/WINDOWS/system32/config/SAM'%mount elif os.path.exists('%s/WINNT/system32/config/SAM'%mount): data['SAM'] = '%s/WINNT/system32/config/SAM'%mount else: print("ERROR, breaks mold : %s , %s" %(add, mount)) elm.exit() return self.add_file(data) else: if origin: os_list = origin if nodev: for mnt in mount.keys(): name = self.identify_windows(mount[mnt], mnt) os_list[mnt] = name if not os_list[mnt]: del os_list[mnt] del mount[mnt] else: self.mount_wins(os_list, mount) else: return print os_list print mount for osys in os_list.keys(): self.add_wins(osys, mount[osys], os_list[osys])
def thumb_clicked(obj): if not elementary.need_ethumb(): print("Ethumb not available!") return images = ( "panel_01.jpg", "plant_01.jpg", "rock_01.jpg", "rock_02.jpg", "sky_01.jpg", "sky_02.jpg", "sky_03.jpg", "sky_04.jpg", "wood_01.jpg", "mystrale.jpg", "mystrale_2.jpg" ) win = elementary.StandardWindow("thumb", "Thumb") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) tb = elementary.Table(win) tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) n = 0 for j in range(12): for i in range(12): th = elementary.Thumb(win) n = (n + 1) % 11 th.file = "images/%s" % (images[n]) th.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) th.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(th, i, j, 1, 1) th.editable = True th.show() sc = elementary.Scroller(win) sc.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(sc) sc.content_set(tb) tb.show() sc.show() win.resize(600, 600) win.show()
def photo_clicked(obj): win = elementary.Window("photo", elementary.ELM_WIN_BASIC) win.title_set("Photo test") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() sc = elementary.Scroller(win) sc.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(sc) sc.show() elementary.need_ethumb() tb = elementary.Table(win) tb.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) sc.content = tb tb.show() n = 0 for j in range(12): for i in range(12): ph = elementary.Photo(win) name = "images/%s" % (images[n]) n += 1 if n >= 9: n = 0 ph.aspect_fixed = False ph.size = 80 if n == 8: ph.thumb = name else: ph.file = name ph.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) ph.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) ph.editable = True if n in [2, 3]: ph.fill_inside = True ph.style = "shadow" tb.pack(ph, i, j, 1, 1) ph.show() win.resize(300, 300) win.show()
def edje_external_slider_clicked(obj): win = elementary.Window("edje-external-slider", elementary.ELM_WIN_BASIC) win.title_set("Edje External Slider") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) ly = elementary.Layout(win) ly.file_set("test_external.edj", "external/slider") ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(ly) ly.show() win.resize(320, 400) win.show()
def icon_transparent_clicked(obj): win = elementary.Window("icon-transparent", elementary.ELM_WIN_BASIC) win.title_set("Icon Transparent") win.autodel_set(True) win.alpha_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) icon = elementary.Icon(win) icon.file_set("images/logo.png") icon.resizable_set(0, 0) win.resize_object_add(icon) icon.show() win.show()
def edje_external_scroller_clicked(obj): win = elementary.Window("edje-external-scroller", elementary.ELM_WIN_BASIC) win.title_set("Edje External Scroller") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) ly = elementary.Layout(win) ly.file_set("test_external.edj", "external/scroller") ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(ly) ly.show() win.resize(320, 400) win.show()
def spinner_clicked(obj): win = elementary.Window("spinner", elementary.ELM_WIN_BASIC) win.title_set("Spinner test") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() bx = elementary.Box(win) bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(bx) bx.show() sp = elementary.Spinner(win) sp.label_format_set("%1.1f units") sp.step_set(1.3) sp.wrap_set(1) sp.min_max_set(-50.0, 250.0) sp.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5) sp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bx.pack_end(sp) sp.show() sp = elementary.Spinner(win) sp.label_format_set("%1.1f units") sp.step_set(1.3) sp.wrap_set(1) sp.style_set("vertical"); sp.min_max_set(-50.0, 250.0) sp.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5) sp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bx.pack_end(sp) sp.show() sp = elementary.Spinner(win) sp.label_format_set("Disabled %.0f") sp.disabled_set(1) sp.min_max_set(-50.0, 250.0) sp.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5) sp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bx.pack_end(sp) sp.show() win.show()
def spinner_clicked(obj): win = elementary.Window("spinner", elementary.ELM_WIN_BASIC) win.title_set("Spinner test") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() bx = elementary.Box(win) bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(bx) bx.show() sp = elementary.Spinner(win) sp.label_format_set("%1.1f units") sp.step_set(1.3) sp.wrap_set(1) sp.min_max_set(-50.0, 250.0) sp.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5) sp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bx.pack_end(sp) sp.show() sp = elementary.Spinner(win) sp.label_format_set("%1.1f units") sp.step_set(1.3) sp.wrap_set(1) sp.style_set("vertical") sp.min_max_set(-50.0, 250.0) sp.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5) sp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bx.pack_end(sp) sp.show() sp = elementary.Spinner(win) sp.label_format_set("Disabled %.0f") sp.disabled_set(1) sp.min_max_set(-50.0, 250.0) sp.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5) sp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bx.pack_end(sp) sp.show() win.show()
def panes_clicked(obj): win = elementary.Window("panes", elementary.ELM_WIN_BASIC) win.title_set("Panes test") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() panes = elementary.Panes(win) win.resize_object_add(panes) panes.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) panes.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) panes.callback_clicked_add(cb_panes, "clicked") panes.callback_clicked_double_add(cb_panes, "clicked,double") panes.callback_press_add(cb_panes, "press") panes.callback_unpress_add(cb_panes, "unpress") panes.show() bt = elementary.Button(win) bt.text = "Left" panes.part_content_set("left", bt) bt.show() panes_h = elementary.Panes(win) panes_h.horizontal = True panes_h.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) panes_h.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) panes.part_content_set("right", panes_h) panes_h.show() bt = elementary.Button(win) bt.text = "Up" panes_h.part_content_set("left", bt) bt.show() bt = elementary.Button(win) bt.text = "Down" panes_h.part_content_set("right", bt) bt.show() win.resize(320, 480) win.show()
def hello_elementary(): window = elementary.StandardWindow("hello world", "Hello Elementary") window.callback_delete_request_add(lambda o: elementary.exit()) windytax = elementary.Label(window) windytax.text = '<b>Hello Elementary!</b>' windytax.show() #Create an elementary button object button = elementary.Button(window) #Set some text for our button button.text = "Goodbye Elementary" #callback_pressed_add tells our button a callback to run when our button is pressed, the first argument is the function run and the following arguments are things to pass to the callback button.callback_pressed_add(button_pressed, "argument1", "argument2") #Show our button button.show() #Since we now have multiple objects we want to display on our window, we need to tell our window how to position these objects an elementary, box is an object that you can "pack" items into and then add to our window #Create a box box = elementary.Box(window) #Tell our box to fill all open space in our window box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) box.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) #Show our box box.show() #Lets pack our label and then button into our box! box.pack_end(windytax) box.pack_end(button) #This time lets add our box to the window instead of just our label window.resize_object_add(box) window.resize(300,300) window.show()
def frame_clicked(obj): win = elementary.Window("frame", elementary.ELM_WIN_BASIC) win.title_set("Frame test") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() vbox = elementary.Box(win) vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(vbox) vbox.show() # frame 1 ic = elementary.Icon(win) ic.file_set("images/logo_small.png") fr = elementary.Frame(win) fr.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) fr.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) fr.text_set("Frame title") fr.content_set(ic) vbox.pack_end(fr) fr.show() # frame 2 (collapsable) ic = elementary.Icon(win) ic.file_set("images/logo_small.png") fr = elementary.Frame(win) fr.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) fr.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) fr.autocollapse_set(True) fr.text_set("Frame collapsable (BROKEN)") fr.content_set(ic) vbox.pack_end(fr) fr.show() win.resize(320, 320) win.show()
def edje_external_pbar_clicked(obj): win = elementary.Window("edje-external-pbar", elementary.ELM_WIN_BASIC) win.title_set("Edje External Progress Bar") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) ly = elementary.Layout(win) ly.file_set("test_external.edj", "external/pbar") ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(ly) ly.show() bt = ly.edje_get().part_external_object_get("ext_button3") bt.text = "...or Pyton" bt.callback_clicked_add(cb_btn3_clicked, ly) win.resize(320, 400) win.show()
def popup_clicked(obj): win = elementary.Window("popup", elementary.ELM_WIN_BASIC) win.title_set("Popup test") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() li = elementary.List(win) li.mode = elementary.ELM_LIST_LIMIT li.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) li.callback_selected_add(lambda li, it: it.selected_set(False)) win.resize_object_add(li) li.show() li.item_append("popup-center-text", None, None, cb_popup_center_text, win) li.item_append("popup-center-text + 1 button", None, None, cb_popup_center_title_text_1button, win) li.item_append("popup-center-title + text + 1 button", None, None, cb_popup_center_title_text_1button, win) li.item_append("popup-center-title + text (block,clicked handling)", None, None, cb_popup_center_title_text_block_clicked_event, win) li.item_append("popup-bottom-title + text + 3 buttons", None, None, cb_popup_bottom_title_text_3button, win) li.item_append("popup-center-title + content + 3 buttons", None, None, cb_popup_center_title_content_3button, win) li.item_append("popup-center-title + items + 3 buttons", None, None, cb_popup_center_title_item_3button, win) li.item_append("popup-center-title + text + 2 buttons (check restacking)", None, None, cb_popup_center_title_text_2button_restack, win) li.item_append("popup-center-text + 1 button (check hide, show)", None, None, cb_popup_center_text_1button_hide_show, win) li.go() win.resize(480, 800) win.show()
def __init__( self, bkend="emotion" ): #Main window - where everything other than popups appears self.mainWindow = elementary.StandardWindow("eAndora", "eAndora - Internet Radio") self.nf = elementary.Naviframe(self.mainWindow) self.nf.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self.nf.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) self.nf.show() self.mainWindow.resize_object_add(self.nf) self.mainWindow.callback_delete_request_add(lambda o: elementary.exit()) #Options are emotion and vlc self.backend = bkend #Our pandora interface instance if self.backend == "vlc": self.ourPlayer = playerVLC.eAndora(self) else: self.ourPlayer = playerClass.eAndora(self) #Location of the PY files for image usage self.location = os.path.dirname(os.path.abspath(__file__))
def thumb_clicked(obj): if not elementary.need_ethumb(): print("Ethumb not available!") return images = ("panel_01.jpg", "plant_01.jpg", "rock_01.jpg", "rock_02.jpg", "sky_01.jpg", "sky_02.jpg", "sky_03.jpg", "sky_04.jpg", "wood_01.jpg", "mystrale.jpg", "mystrale_2.jpg") win = elementary.StandardWindow("thumb", "Thumb") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) tb = elementary.Table(win) tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) n = 0 for j in range(12): for i in range(12): th = elementary.Thumb(win) n = (n + 1) % 11 th.file = "images/%s" % (images[n]) th.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) th.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(th, i, j, 1, 1) th.editable = True th.show() sc = elementary.Scroller(win) sc.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(sc) sc.content_set(tb) tb.show() sc.show() win.resize(600, 600) win.show()
def layout_clicked(obj): win = elementary.Window("layout", elementary.ELM_WIN_BASIC) win.title_set("Layout") win.elm_event_callback_add(_event) win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() ly = elementary.Layout(win) ly.file_set("test.edj", "layout") ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(ly) ly.show() bt = elementary.Button(win) bt.text_set("Button 1") ly.part_content_set("element1", bt) bt.elm_event_callback_add(_event) bt.elm_event_callback_del(_event) bt.show() bt = elementary.Button(win) bt.text_set("Button 2") ly.part_content_set("element2", bt) bt.show() bt = elementary.Button(win) bt.text_set("Button 3") ly.part_content_set("element3", bt) bt.show() win.show()
def destroy(obj): elementary.exit()
def web_clicked(obj): if not elementary.need_web(): print("EFL-webkit not available!") return win = elementary.Window("web", elementary.ELM_WIN_BASIC) win.title_set("Web") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() vbx = elementary.Box(win) win.resize_object_add(vbx) vbx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) vbx.show() web = elementary.Web(win) web.uri_set("http://enlightenment.org/") web.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) web.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) web.size_hint_min_set(100, 100) vbx.pack_end(web) web.show() # Debug: def dbg(*args): print(("DEBUG: %s" % args[-1], " ".join(repr(x) for x in args[1:-1]))) web.callback_link_hover_in_add(dbg, "link in") web.callback_link_hover_out_add(dbg, "link out") web.callback_uri_changed_add(dbg, "uri") web.callback_title_changed_add(dbg, "title") web.callback_load_finished_add(dbg, "load finished") web.callback_load_finished_add(dbg, "load error") web.callback_load_progress_add(dbg, "load progress") web.callback_load_provisional_add(dbg, "load provisional") web.callback_load_started_add(dbg, "load started") # JS debug to console: def console_msg(obj, msg, line, src): print(("CONSOLE: %s:%d %r" % (src, line, msg))) web.console_message_hook_set(console_msg) # navigation bar: hbx = elementary.Box(win) hbx.horizontal_set(True) hbx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) hbx.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0) vbx.pack_start(hbx) hbx.show() bt = elementary.Button(win) bt.text_set("Back") bt.callback_clicked_add(lambda x: web.back()) hbx.pack_end(bt) bt.show() bt = elementary.Button(win) bt.text_set("Forward") bt.callback_clicked_add(lambda x: web.forward()) hbx.pack_end(bt) bt.show() bt = elementary.Button(win) bt.text_set("Reload") bt.callback_clicked_add(lambda x: web.reload()) hbx.pack_end(bt) bt.show() bt = elementary.Button(win) bt.text_set("Stop") bt.callback_clicked_add(lambda x: web.stop()) hbx.pack_end(bt) bt.show() en = elementary.Entry(win) en.scrollable_set(True) en.editable_set(True) en.single_line_set(True) en.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) en.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) hbx.pack_end(en) en.show() # Sync navigation entry and current URI def do_change_uri(en): web.uri = en.entry def did_change_uri(web, uri, en): en.entry = uri en.callback_activated_add(do_change_uri) web.callback_uri_changed_add(did_change_uri, en) # Sync title def did_change_title(web, title, win): win.title_set("Web - %s" % title) web.callback_title_changed_add(did_change_title, win) win.resize(800, 600) win.show()
def exit(self): '''Exit from UI mainloop''' elementary.exit()
def tooltip_clicked(obj): win = elementary.Window("tooltips", elementary.ELM_WIN_BASIC) win.title_set("Tooltips") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() bx = elementary.Box(win) win.resize_object_add(bx) bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bx.show() tb = elementary.Toolbar(win) tb.homogeneous_set(False) tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) tb.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0) bx.pack_end(tb) tb.show() ti = tb.item_append("folder-new", "Open", None, None) ti.tooltip_text_set("Opens a file") ti = tb.item_append("clock", "Icon", None, None) ti.tooltip_content_cb_set(_tt_item_icon, None) ti.tooltip_style_set("transparent") bt = elementary.Button(win) bt.text_set("Simple text tooltip") bt.tooltip_text_set("Simple text tooltip") bx.pack_end(bt) bt.show() def _tt_text_replace(obj, data): value = data.get("value") if not value: value = 1 obj.tooltip_text_set("count=%d" % value) value += 1 data["value"] = value bt = elementary.Button(win) bt.text_set("Simple text tooltip, click to change") bt.tooltip_text_set("Initial") data = dict() bt.callback_clicked_add(_tt_text_replace, data) bx.pack_end(bt) bt.show() def _tt_text_replace_timer_cb(obj, data): _tt_text_replace(obj, data) return True def _tt_text_replace_timed(obj, data, *args, **kargs): timer = data.get("timer") if timer: timer.delete() del data["timer"] obj.text_set("Simple text tooltip, click to start changed timed") return data["timer"] = ecore.timer_add(1.5, _tt_text_replace_timer_cb, obj, data) obj.text_set("Simple text tooltip, click to stop changed timed") bt = elementary.Button(win) bt.text_set("Simple text tooltip, click to start changed timed") bt.tooltip_text_set("Initial") data = dict() bt.callback_clicked_add(_tt_text_replace_timed, data) bx.pack_end(bt) bt.show() bt.on_del_add(_tt_timer_del, data) bt = elementary.Button(win) bt.text_set("Icon tooltip") bt.tooltip_content_cb_set(_tt_icon, None) bx.pack_end(bt) bt.show() def _tt_icon_replace_timer_cb(obj, data): value = data.get("value") data["value"] = not value if value: obj.tooltip_content_cb_set(_tt_icon) else: obj.tooltip_content_cb_set(_tt_icon2) return True def _tt_icon_replace_timed(obj, data, *args, **kargs): timer = data.get("timer") if timer: timer.delete() del data["timer"] obj.text_set("Icon tooltip, click to start changed timed") return data["timer"] = ecore.timer_add(1.5, _tt_icon_replace_timer_cb, obj, data) obj.text_set("Icon tooltip, click to stop changed timed") bt = elementary.Button(win) bt.text_set("Icon tooltip, click to start changed timed") bt.tooltip_content_cb_set(_tt_icon) data = dict() bt.callback_clicked_add(_tt_icon_replace_timed, data) bx.pack_end(bt) bt.show() bt.on_del_add(_tt_timer_del, data) bt = elementary.Button(win) bt.text_set("Transparent Icon tooltip") bt.tooltip_content_cb_set(_tt_icon, None) bt.tooltip_style_set("transparent") bx.pack_end(bt) bt.show() def _tt_style_replace_timer_cb(obj, data): value = data.get("value") data["value"] = not value if value: obj.tooltip_style_set() else: obj.tooltip_style_set("transparent") return True def _tt_style_replace_timed(obj, data, *args, **kargs): timer = data.get("timer") if timer: timer.delete() del data["timer"] obj.text_set("Icon tooltip style, click to start changed timed") return data["timer"] = ecore.timer_add(1.5, _tt_style_replace_timer_cb, obj, data) obj.text_set("Icon tooltip, click to stop changed timed") bt = elementary.Button(win) bt.text_set("Icon tooltip style, click to start changed timed") bt.tooltip_content_cb_set(_tt_icon, None) data = dict() bt.callback_clicked_add(_tt_style_replace_timed, data) bx.pack_end(bt) bt.show() bt.on_del_add(_tt_timer_del, data) def _tt_visible_lock_toggle(obj, data, *args, **kargs): value = data.get("value") data["value"] = not value if value: obj.text_set("Unlocked tooltip visibility") obj.tooltip_hide() else: obj.text_set("Locked tooltip visibility") obj.tooltip_show() bt = elementary.Button(win) bt.text_set("Unlocked tooltip visibility") bt.tooltip_text_set( "This tooltip is unlocked visible,<br> clock the button to lock!") data = dict() bt.callback_clicked_add(_tt_visible_lock_toggle, data) bx.pack_end(bt) bt.show() en = elementary.Entry(win) en.scrollable_set(True) en.single_line_set(True) en.entry_set("Hello, some scrolled entry here!") en.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) en.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5) en.tooltip_text_set("Type something here!") bx.pack_end(en) en.show() lst = elementary.List(win) li = lst.item_append("Hello") li.tooltip_text_set("Something useful here?") li = lst.item_append("Icon Tooltip") li.tooltip_content_cb_set(_tt_item_icon, None) lst.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) lst.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) lst.size_hint_min_set(100, 100) bx.pack_end(lst) lst.go() lst.show() win.show() win.resize(400, 500)
def gengrid_clicked(obj): global item_count item_count = 25 # window win = elementary.Window("gengrid", elementary.ELM_WIN_BASIC) win.title_set("Gengrid") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) # background bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() # main table tb = elementary.Table(win) win.resize_object_add(tb) tb.homogeneous_set(0) tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) tb.show() # gengrid itc = elementary.GengridItemClass(item_style="default", text_get_func=gg_text_get, content_get_func=gg_content_get, state_get_func=gg_state_get, del_func=gg_del) gg = elementary.Gengrid(win) gg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) gg.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) gg.horizontal_set(False) gg.bounce_set(False, True) gg.item_size_set(80, 80) gg.align_set(0.5, 0.0) tb.pack(gg, 0, 0, 6, 1) gg.callback_selected_add(gg_sel) gg.callback_unselected_add(gg_unsel) gg.callback_clicked_double_add(gg_clicked_double) gg.show() # add the first items for i in range(item_count): gg.item_append(itc, i, None) # multi select def multi_select_changed(bt, gg): gg.multi_select_set(bt.state) print((gg.multi_select_get())) bt = elementary.Check(win) bt.text = "MultiSelect" bt.state = gg.multi_select_get() bt.callback_changed_add(multi_select_changed, gg) tb.pack(bt, 0, 1, 1, 1) bt.show() # horizontal def horizontal_changed(bt, gg): gg.horizontal_set(bt.state) bt = elementary.Check(win) bt.text_set("Horizontal") bt.callback_changed_add(horizontal_changed, gg) tb.pack(bt, 1, 1, 1, 1) bt.show() # bounce h def bounce_h_changed(bt, gg): (h_bounce, v_bounce) = gg.bounce_get() gg.bounce_set(bt.state, v_bounce) print((gg.bounce_get())) bt = elementary.Check(win) bt.text_set("BounceH") (h_bounce, v_bounce) = gg.bounce_get() bt.state = h_bounce bt.callback_changed_add(bounce_h_changed, gg) tb.pack(bt, 4, 1, 1, 1) bt.show() # bounce v def bounce_v_changed(bt, gg): (h_bounce, v_bounce) = gg.bounce_get() gg.bounce_set(h_bounce, bt.state) print((gg.bounce_get())) bt = elementary.Check(win) bt.text_set("BounceV") (h_bounce, v_bounce) = gg.bounce_get() bt.state = v_bounce bt.callback_changed_add(bounce_v_changed, gg) tb.pack(bt, 5, 1, 1, 1) bt.show() # item size def item_size_w_changed(sl, gg): (w, h) = gg.item_size_get() gg.item_size_set(sl.value, h) print((gg.item_size_get())) def item_size_h_changed(sl, gg): (w, h) = gg.item_size_get() gg.item_size_set(w, sl.value) print((gg.item_size_get())) sl = elementary.Slider(win) sl.text_set("ItemSizeW") sl.min_max_set(0, 500) sl.indicator_format_set("%.0f") sl.unit_format_set("%.0f") sl.span_size_set(100) (w, h) = gg.item_size_get() sl.value = w sl.callback_changed_add(item_size_w_changed, gg) tb.pack(sl, 0, 2, 2, 1) sl.show() sl = elementary.Slider(win) sl.text_set("ItemSizeH") sl.min_max_set(0, 500) sl.indicator_format_set("%.0f") sl.unit_format_set("%.0f") sl.span_size_set(100) (w, h) = gg.item_size_get() sl.value = h sl.callback_changed_add(item_size_h_changed, gg) tb.pack(sl, 0, 3, 2, 1) sl.show() # align def alignx_changed(sl, gg): (ax, ay) = gg.align_get() gg.align_set(sl.value, ay) print((gg.align_get())) def aligny_changed(sl, gg): (ax, ay) = gg.align_get() gg.align_set(ax, sl.value) print((gg.align_get())) sl = elementary.Slider(win) sl.text_set("AlignX") sl.min_max_set(0.0, 1.0) sl.indicator_format_set("%.2f") sl.unit_format_set("%.2f") sl.span_size_set(100) (ax, ay) = gg.align_get() sl.value = ax sl.callback_changed_add(alignx_changed, gg) tb.pack(sl, 0, 4, 2, 1) sl.show() sl = elementary.Slider(win) sl.text_set("AlignY") sl.min_max_set(0.0, 1.0) sl.indicator_format_set("%.2f") sl.unit_format_set("%.2f") sl.span_size_set(100) (ax, ay) = gg.align_get() sl.value = ax sl.callback_changed_add(aligny_changed, gg) tb.pack(sl, 0, 5, 2, 1) sl.show() # select first def select_first_clicked(bt, gg): ggi = gg.first_item ggi.selected = not ggi.selected bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Select first") bt.callback_clicked_add(select_first_clicked, gg) tb.pack(bt, 2, 2, 1, 1) bt.show() # select last def select_last_clicked(bt, gg): ggi = gg.last_item ggi.selected = not ggi.selected bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Select last") bt.callback_clicked_add(select_last_clicked, gg) tb.pack(bt, 3, 2, 1, 1) bt.show() # selection del def seldel_clicked(bt, gg): for ggi in gg.selected_items_get(): ggi.delete() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Sel del") bt.callback_clicked_add(seldel_clicked, gg) tb.pack(bt, 4, 2, 1, 1) bt.show() # clear def clear_clicked(bt, gg): global item_count item_count = 0 gg.clear() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Clear") bt.callback_clicked_add(clear_clicked, gg) tb.pack(bt, 5, 2, 1, 1) bt.show() # show first/last def show_clicked(bt, gg, first): ggi = gg.first_item if first else gg.last_item ggi.show() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Show first") bt.callback_clicked_add(show_clicked, gg, True) tb.pack(bt, 2, 3, 1, 1) bt.show() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Show last") bt.callback_clicked_add(show_clicked, gg, False) tb.pack(bt, 3, 3, 1, 1) bt.show() # bring-in first/last def bring_in_clicked(bt, gg, first): ggi = gg.first_item if first else gg.last_item ggi.bring_in() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("BringIn first") bt.callback_clicked_add(bring_in_clicked, gg, True) tb.pack(bt, 4, 3, 1, 1) bt.show() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("BringIn last") bt.callback_clicked_add(bring_in_clicked, gg, False) tb.pack(bt, 5, 3, 1, 1) bt.show() # append def append_clicked(bt, gg, n): global item_count while n: item_count += 1 gg.item_append(itc, item_count, None) n -= 1 bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Append 1") bt.callback_clicked_add(append_clicked, gg, 1) tb.pack(bt, 2, 4, 1, 1) bt.show() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Append 100") bt.callback_clicked_add(append_clicked, gg, 100) tb.pack(bt, 3, 4, 1, 1) bt.show() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Append 1000") bt.callback_clicked_add(append_clicked, gg, 1000) tb.pack(bt, 4, 4, 1, 1) bt.show() bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Append 10000 :)") bt.callback_clicked_add(append_clicked, gg, 10000) tb.pack(bt, 5, 4, 1, 1) bt.show() # prepend def prepend_clicked(bt, gg): global item_count item_count += 1 gg.item_prepend(itc, item_count) bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Prepend") bt.callback_clicked_add(prepend_clicked, gg) tb.pack(bt, 2, 5, 1, 1) bt.show() # insert_before def ins_before_clicked(bt, gg): global item_count item_count += 1 before = gg.selected_item_get() if before: gg.item_insert_before(itc, item_count, before) else: print("nothing selected") bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Ins before") bt.callback_clicked_add(ins_before_clicked, gg) tb.pack(bt, 3, 5, 1, 1) bt.show() # insert_after def ins_after_clicked(bt, gg): global item_count item_count += 1 after = gg.selected_item_get() if after: gg.item_insert_after(itc, item_count, after) else: print("nothing selected") bt = elementary.Button(win) bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0) bt.text_set("Ins after") bt.callback_clicked_add(ins_after_clicked, gg) tb.pack(bt, 4, 5, 1, 1) bt.show() win.resize(480, 800) win.show()
def scroller_clicked(obj): win = elementary.Window("scroller", elementary.ELM_WIN_BASIC) win.title_set("Scroller") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() tb = elementary.Table(win) tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) img = [ "images/panel_01.jpg", "images/plant_01.jpg", "images/rock_01.jpg", "images/rock_02.jpg", "images/sky_01.jpg", "images/sky_02.jpg", "images/sky_03.jpg", "images/sky_04.jpg", "images/wood_01.jpg" ] n = 0 for j in range(12): for i in range(12): bg2 = elementary.Background(win) bg2.file_set(img[n]) n = n + 1 if n >= 9: n = 0 bg2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bg2.size_hint_min_set(318, 318) tb.pack(bg2, i, j, 1, 1) bg2.show() sc = elementary.Scroller(win) sc.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) sc.callback_edge_top_add(cb_edges, "top") sc.callback_edge_bottom_add(cb_edges, "bottom") sc.callback_edge_left_add(cb_edges, "left") sc.callback_edge_right_add(cb_edges, "right") sc.callback_scroll_drag_start_add(cb_drags, "start") sc.callback_scroll_drag_stop_add(cb_drags, "stop") sc.callback_scroll_anim_start_add(cb_anims, "start") sc.callback_scroll_anim_stop_add(cb_anims, "stop") win.resize_object_add(sc) sc.content_set(tb) tb.show() sc.page_relative_set(1.0, 1.0) sc.show() tb2 = elementary.Table(win) tb2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(tb2) bt = elementary.Button(win) bt.text_set("to 300 300") bt.callback_clicked_add(my_scroller_go_300_300, sc) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.1, 0.1) tb2.pack(bt, 0, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("to 900 300") bt.callback_clicked_add(my_scroller_go_900_300, sc) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.9, 0.1) tb2.pack(bt, 1, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("to 300 900") bt.callback_clicked_add(my_scroller_go_300_900, sc) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.1, 0.9) tb2.pack(bt, 0, 1, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("to 900 900") bt.callback_clicked_add(my_scroller_go_900_900, sc) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.9, 0.9) tb2.pack(bt, 1, 1, 1, 1) bt.show() tb2.show() win.resize(320, 320) win.show()
def actionslider_clicked(obj): win = elementary.Window("actionslider", elementary.ELM_WIN_BASIC) win.title_set("Actionslider") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(bg) bg.show() bx = elementary.Box(win) bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(bx) bx.show() acts = elementary.Actionslider(win) acts.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) acts.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0) acts.indicator_pos_set(elementary.ELM_ACTIONSLIDER_RIGHT) acts.magnet_pos_set(elementary.ELM_ACTIONSLIDER_RIGHT) acts.part_text_set("left", "Snooze") acts.part_text_set("center", "") acts.part_text_set("right", "Stop") acts.enabled_pos_set(elementary.ELM_ACTIONSLIDER_LEFT | elementary.ELM_ACTIONSLIDER_RIGHT) acts.callback_pos_changed_add(_position_change_magnetic_cb) acts.callback_selected_add(_pos_selected_cb) bx.pack_end(acts) acts.show() acts = elementary.Actionslider(win) acts.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) acts.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0) acts.indicator_pos_set(elementary.ELM_ACTIONSLIDER_CENTER) acts.magnet_pos_set(elementary.ELM_ACTIONSLIDER_CENTER) acts.part_text_set("left", "Snooze") acts.part_text_set("center", "") acts.part_text_set("right", "Stop") acts.enabled_pos_set(elementary.ELM_ACTIONSLIDER_LEFT | elementary.ELM_ACTIONSLIDER_RIGHT) acts.callback_selected_add(_pos_selected_cb) bx.pack_end(acts) acts.show() acts = elementary.Actionslider(win) acts.style_set("bar") acts.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) acts.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0) acts.indicator_pos_set(elementary.ELM_ACTIONSLIDER_LEFT) acts.magnet_pos_set(elementary.ELM_ACTIONSLIDER_CENTER | elementary.ELM_ACTIONSLIDER_RIGHT) acts.enabled_pos_set(elementary.ELM_ACTIONSLIDER_CENTER | elementary.ELM_ACTIONSLIDER_RIGHT) acts.part_text_set("left", "") acts.part_text_set("center", "Accept") acts.part_text_set("right", "Reject") acts.callback_selected_add(_pos_selected_cb) bx.pack_end(acts) acts.show() acts = elementary.Actionslider(win) acts.style_set("bar") acts.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) acts.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0) acts.indicator_pos_set(elementary.ELM_ACTIONSLIDER_LEFT) acts.magnet_pos_set(elementary.ELM_ACTIONSLIDER_LEFT) acts.part_text_set("left", "") acts.part_text_set("center", "Accept") acts.part_text_set("right", "Reject") acts.text_set("Go") acts.callback_pos_changed_add(_position_change_magnetic_cb) acts.callback_selected_add(_pos_selected_cb) bx.pack_end(acts) acts.show() acts = elementary.Actionslider(win) acts.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) acts.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0) acts.indicator_pos_set(elementary.ELM_ACTIONSLIDER_LEFT) acts.magnet_pos_set(elementary.ELM_ACTIONSLIDER_ALL) acts.part_text_set("left", "Left") acts.part_text_set("center", "Center") acts.part_text_set("right", "Right") acts.text_set("Go") acts.callback_selected_add(_pos_selected_cb) bx.pack_end(acts) acts.show() acts = elementary.Actionslider(win) acts.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) acts.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0) acts.indicator_pos_set(elementary.ELM_ACTIONSLIDER_CENTER) acts.magnet_pos_set(elementary.ELM_ACTIONSLIDER_CENTER) acts.part_text_set("left", "Enable") acts.part_text_set("center", "Magnet") acts.part_text_set("right", "Disable") acts.callback_pos_changed_add(_magnet_enable_disable_cb) acts.callback_selected_add(_pos_selected_cb) bx.pack_end(acts) acts.show() win.resize(320, 400) win.show()
def toolbar_clicked(obj): win = elementary.Window("toolbar", elementary.ELM_WIN_BASIC) win.title_set("Toolbar") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() bx = elementary.Box(win) win.resize_object_add(bx) bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bx.show() tb = elementary.Toolbar(win) tb.homogeneous = False tb.size_hint_weight_set(0.0, 0.0) tb.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0) ph1 = elementary.Photo(win) ph2 = elementary.Photo(win) ph3 = elementary.Photo(win) ph4 = elementary.Photo(win) item = tb.item_append("document-print", "Hello", tb_1) item.disabled = True item = tb.item_append("clock", "World,", tb_2, ph2) item.selected_set(True) tb.item_append("folder-new", "here", tb_3, ph4) tb.item_append("clock", "comes", tb_4, ph4) tb.item_append("folder-new", "python-elementary!", tb_5, ph4) item = tb.item_append("clock", "Menu", tb_5, ph4) item.menu_set(True) tb.menu_parent_set(win) menu = item.menu_get() menu.item_add(None, "Here", "clock", tb_3, ph4) menu_item = menu.item_add(None, "Comes", "refresh", tb_4, ph4) menu.item_add(menu_item, "hey ho", "folder-new", tb_4, ph4) menu.item_add(None, "python-elementary", "document-print", tb_5, ph4) bx.pack_end(tb) tb.show() tb = elementary.Table(win) tb.size_hint_weight_set(0.0, evas.EVAS_HINT_EXPAND) tb.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) ph1.size_set(40) ph1.file_set("images/plant_01.jpg") ph1.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) ph1.size_hint_align_set(0.5, 0.5) tb.pack(ph1, 0, 0, 1, 1) ph1.show() ph2.size_set(80) ph2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) ph2.size_hint_align_set(0.5, 0.5) tb.pack(ph2, 1, 0, 1, 1) ph2.show() ph3.size_set(40) ph3.file_set("images/sky_01.jpg") ph3.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) ph3.size_hint_align_set(0.5, 0.5) tb.pack(ph3, 0, 1, 1, 1) ph3.show() ph4.size_set(60) ph4.file_set("images/sky_02.jpg") ph4.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) ph4.size_hint_align_set(0.5, 0.5) tb.pack(ph4, 1, 1, 1, 1) ph4.show() bx.pack_end(tb) tb.show() win.resize(320, 300) win.show()
def segment_control_clicked(obj): win = elementary.Window("segment-control", elementary.ELM_WIN_BASIC) win.title_set("Segment Control test") win.autodel_set(True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() vbox = elementary.Box(win) vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) win.resize_object_add(vbox) vbox.show() # segment 1 seg = elementary.SegmentControl(win) seg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) seg.size_hint_align = (evas.EVAS_HINT_FILL, 0.5) seg.item_add(None, "Only Text") ic = elementary.Icon(win) ic.file = "images/logo_small.png" it = seg.item_add(ic) ic = elementary.Icon(win) ic.file = "images/logo_small.png" seg.item_add(ic, "Text + Icon") seg.item_add(None, "Seg4") seg.item_add(None, "Seg5") seg.callback_changed_add(cb_seg_changed) # it.selected_set(True) vbox.pack_end(seg) seg.show() # segment 2 seg = elementary.SegmentControl(win) seg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) seg.size_hint_align = (evas.EVAS_HINT_FILL, 0.5) seg.item_add(None, "SegmentItem") it = seg.item_add(None, "SegmentItem") seg.item_add(None, "SegmentItem") seg.item_add(None, "SegmentItem") print it # it.selected_set(True) vbox.pack_end(seg) seg.show() # segment 3 seg = elementary.SegmentControl(win) seg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) seg.size_hint_align = (0.5, 0.5) for i in range(3): ic = elementary.Icon(win) ic.file = "images/logo_small.png" if i == 1: it = seg.item_add(ic) else: seg.item_add(ic) # it.selected_set(True) vbox.pack_end(seg) seg.show() # segment 4 seg = elementary.SegmentControl(win) seg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) seg.size_hint_align = (evas.EVAS_HINT_FILL, 0.5) seg.item_add(None, "Disabled") ic = elementary.Icon(win) ic.file = "images/logo_small.png" seg.item_add(ic, "Disabled") ic = elementary.Icon(win) ic.file = "images/logo_small.png" seg.item_add(ic) seg.disabled = True # it.selected_set(True) vbox.pack_end(seg) seg.show() win.resize(320, 280) win.show()