def popup_screenmode(self, mp): assets = self.assets sw, sh = self.sw, self.sh self.res_box.pane.children[:] = [] for mode in [ "scaled_single", "two_screens", "horizontal", "small_bottom_screen", "show_one" ]: r = gui.radiobutton("%s" % mode, "scropt") self.res_box.add_child(r) s_c = r.set_checked def set_checked1(val): s_c(val) assets.screen_mode = r.text wini(assets) assets.make_screen() r.set_checked = set_checked1 self.screens = gui.radiobutton.groups["scropt"] for r in self.screens: if r.text == assets.screen_mode: r.checked = True self.res_box.updatescroll()
def popup_resolution(self,mp): assets = self.assets sw,sh = self.sw,self.sh self.res_box.pane.children[:] = [] h = 192 if get_screen_mode(assets)=="two_screens": h*=2 h2 = h*2 self.res_box.add_child(gui.radiobutton("(%sx%s)"%(assets.swidth,assets.sheight),"resopt")) self.res_box.pane.children[-1].checked = True self.res_box.add_child(gui.radiobutton("DS Res (256x%s)"%h,"resopt")) self.res_box.add_child(gui.radiobutton("Double scale (512x%s)"%h2,"resopt")) for mode in sorted(pygame.display.list_modes()): self.res_box.add_child(gui.radiobutton("(%sx%s)"%mode,"resopt")) self.reses = gui.radiobutton.groups["resopt"] for r in self.reses: if str(assets.swidth)+"x" in r.text and "x"+str(assets.sheight) in r.text: r.checked = True self.res_box.updatescroll()
def popup_resolution(self, mp): assets = self.assets sw, sh = self.sw, self.sh self.res_box.pane.children[:] = [] h = 192 if get_screen_mode(assets) == "two_screens": h *= 2 h2 = h * 2 self.res_box.add_child( gui.radiobutton("(%sx%s)" % (assets.swidth, assets.sheight), "resopt")) self.res_box.pane.children[-1].checked = True self.res_box.add_child(gui.radiobutton("DS Res (256x%s)" % h, "resopt")) self.res_box.add_child( gui.radiobutton("Double scale (512x%s)" % h2, "resopt")) for mode in sorted(pygame.display.list_modes()): self.res_box.add_child(gui.radiobutton("(%sx%s)" % mode, "resopt")) self.reses = gui.radiobutton.groups["resopt"] for r in self.reses: if str(assets.swidth) + "x" in r.text and "x" + str( assets.sheight) in r.text: r.checked = True self.res_box.updatescroll()
def popup_screenmode(self,mp): assets = self.assets sw,sh = self.sw,self.sh self.res_box.pane.children[:] = [] for mode in ["scaled_single","two_screens","horizontal","small_bottom_screen","show_one"]: r = gui.radiobutton("%s"%mode,"scropt") self.res_box.add_child(r) s_c = r.set_checked def set_checked1(val): s_c(val) assets.screen_mode = r.text wini(assets) assets.make_screen() r.set_checked = set_checked1 self.screens = gui.radiobutton.groups["scropt"] for r in self.screens: if r.text==assets.screen_mode: r.checked = True self.res_box.updatescroll()
def page(arg): ## SAVE PROPERTIES arg.hprops = sn(**{}) arg.hobjs = sn(**{}) arg.hvars = sn(**{}) arg.hprops.__dict__[arg.curpage] = sn(**{}) arg.hobjs.__dict__[arg.curpage] = sn(**{}) arg.hvars.__dict__[arg.curpage] = sn(**{}) h = sn(**{}) ####################### GUI ELEMENTS START ######################### h.myEntry = sn( ** { ## gui.entry(arg,"style","align","text", name="entryName" ,password=True, keyboard=True, type=number), "obj": gui.entry(arg, "entryMedium", "center", "Edit me!", name="myEntry", password=True, keyboard=True), "pos": sn(**{ "x": 10, "y": 10, "w": 150, "h": 30, }) }) h.label1 = sn( **{ ## gui.label(arg,"style","align","text") "obj": gui.label(arg, "labelSmall", "center", "Hello There!"), "pos": sn(**{ "x": 100, "y": 300, "w": 100, "h": 40, }) }) # h.checkbox = sn(**{ ## gui.checkbox(arg,"yourText", lambda: test(arg)), # "obj": gui.checkbox(arg,"yourText", lambda: test(arg)), # "pos": sn(**{ # "x": 10, # "y": 10, # "w": 150, # "h": 30, # }) # }) h.checkbox = sn( **{ ## gui.checkbox(arg,"yourText", lambda: test(arg)), "obj": gui.checkbox(arg, "yourText", lambda: test(arg, 1)), "pos": sn(**{ "x": 10, "y": 40, "w": 150, "h": 30, }) }) optionList1 = ('a', 'a', 'b', 'c') h.combobox = sn( ** { ## ttk.OptionMenu(arg.master,v1,*optionList1, command=lambda selected:test123123(selected)) "obj": gui.combobox(arg, optionList1, lambda selected_val: test(arg, selected_val)), "pos": sn(**{ "x": 10, "y": 80, "w": 150, "h": 30, }) }) h.progress = sn( ** { ## tttk.Progressbar(arg.master, orient = orient, length = length, mode = mode) "obj": gui.progressbar(arg), "pos": sn(**{ "x": 10, "y": 120, "w": 150, "h": 30, }) }) h.radiobutton = sn( ** { ## Radiobutton(arg.master,text="t",padx = 20, variable=v, command=command,value=value).pack(anchor=tk.W) "obj": gui.radiobutton(arg, text="option1", variable=radiobutton_var, value=1, command=lambda: test(arg, 1)), "pos": sn(**{ "x": 10, "y": 160, "w": 150, "h": 30, }) }) h.radiobutton2 = sn( ** { ## Radiobutton(arg.master,text="t",padx = 20, variable=v, command=command,value=value).pack(anchor=tk.W) "obj": gui.radiobutton(arg, text="option1", variable=radiobutton_var, value=2, command=lambda: test(arg, 1)), "pos": sn(**{ "x": 10, "y": 200, "w": 150, "h": 30, }) }) ####################### GUI ELEMENTS END ######################### gui.hpropsobjs(arg, h) return h