def build(self): self.game = FloatLayout() _debug = debug() self.image = img() self.box = box() #image.reload() self.game.add_widget(_debug) self.game.add_widget(self.image) self.game.add_widget(self.box) # while index isn't specified, widgets added last fires first s = box_size() self.game.add_widget(s) img_btn = Button(text="Load IMG", size_hint = (.1,.1)) img_btn.bind(on_release = self.load_img) self.game.add_widget(img_btn) return self.game
def __init__(self, **kwargs): super(WinScreen, self).__init__(**kwargs) self.layout = FloatLayout() self.winText = Label( text='CONGRATULATIONS\n\nTHE CURE IS MIXED\n\nTIME: ' + timer.text, font_size=70, halign='center') self.add_widget(self.layout) self.add_widget(self.winText) # led.blink(5, 5, 1) # Reset timer and go to start screen def restart(): keyboard.remove_hotkey(self.hotkey) timer.a = 3600 sm.switch_to(IntroLogo()) # Add custom KeyBoardListener that triggers the switch-function on enter-key self.hotkey = keyboard.add_hotkey('ctrl+shift+r', restart)
def build(self): temp, weather = getWeather() temp = round((temp - 273) * 9/5 + 32) layout = FloatLayout(size=(300, 300)) date = datetime.datetime.now() timeString = date.strftime("%I:%M %p") dateString = date.strftime("%B %d, %Y") tempString = "It is currently " + str(temp) + " degrees" self.temperature = Label(text=tempString, size_hint=(.6, .6), pos=(150, 900), font_size=30) self.temperature.size_hint = (0.1, 0.1) self.time = Label(text=timeString, size_hint=(.6, .6), pos=(1700, 900), font_size=30) self.time.size_hint = (0.1, 0.1) self.day = Label(text=dateString, size_hint=(.6, .6), pos=(1650, 850), font_size=30) self.day.size_hint = (0.1, 0.1) layout.add_widget(self.day) layout.add_widget(self.time) layout.add_widget(self.temperature) t = 5.0 # 1/60th of a second, use 1.0 instead to update every second Clock.schedule_interval(self.update, t) return layout
def __init__(self, **kwargs): super(w1, self).__init__(**kwargs) l1 = FloatLayout() self.add_widget(l1) b1 = Button(text="Start", font_size=20, size_hint=(0.3, 0.2), pos_hint={ "x": 0.35, "top": 0.9 }, background_color=[0, 1, 0, 0.5], color=[0.929, 0.961, 0.882, 1], bold=True, on_press=self.change_to_gs) b2 = Button(text="Instructions", font_size=20, size_hint=(0.3, 0.2), pos_hint={ "x": 0.35, "top": 0.6 }, background_color=[0, 0, 1, 0.7], color=[0.929, 0.961, 0.882, 1], bold=True, on_press=self.change_to_ins) b3 = Button(text="Quit", font_size=20, size_hint=(0.3, 0.2), pos_hint={ "x": 0.35, "top": 0.3 }, background_color=[255, 0, 0, 0.7], on_press=w1.quit_app, color=[0.929, 0.961, 0.882, 1], bold=True) l1.add_widget(b1) l1.add_widget(b2) l1.add_widget(b3)
def build(self): self.main_layout2 = FloatLayout(size=(50, 50)) try: Window.clearcolor = (1, 1, 1, 1) a = Image(source='ar1.png',size=(1200,900)) self.main_layout2.add_widget(a) except: pass label1 = Label(text='item name',color=[255,255, 255, 1], size_hint=(.20, .10), pos_hint={'x': .2, 'y': .70}) self.main_layout2.add_widget(label1) self.textbox1 = TextInput( multiline=False, readonly=False, font_size=40, size_hint = (.35, .1), pos_hint={'x': .50, 'y': .70} ) self.main_layout2.add_widget(self.textbox1) button1 = Button( text='search',background_color = (0, 255, 0, 0.7), size_hint=(.20,.08), pos_hint={'x': .30, 'y': .30} ) button1.bind(on_press=self.search) self.main_layout2.add_widget(button1) button2 = Button( text='Back',background_color = (0, 255, 0, 0.7), size_hint=(.20,.08), pos_hint={'x': .55, 'y': .30} ) button2.bind(on_press=self.back) #self.objret = textbox(self.textbox1.text,self.textbox2.text) self.main_layout2.add_widget(button2) return self.main_layout2
def build(self): self.layout = FloatLayout(size=(50, 50)) # Create a camera object self.cameraObject = Camera(play=False) self.cameraObject.play = True self.cameraObject.resolution = (300, 300) # Specify the resolution # Create a button for taking photograph self.camaraClick = Button(text="Take Photo") self.camaraClick.size_hint = (.1, .1) self.camaraClick.pos_hint = {'x': .30, 'y': .10} # bind the button's on_press to onCameraClick self.camaraClick.bind(on_press=self.onCameraClick) self.back = Button(text="back") self.back.size_hint = (.1, .1) self.back.pos_hint = {'x': .60, 'y': .10} # bind the button's on_press to onCameraClick self.back.bind(on_press=self.backclick) # add camera and button to the layout self.layout.add_widget(self.cameraObject) self.layout.add_widget(self.camaraClick) self.layout.add_widget(self.back) # return the root widget return self.layout
def __init__(self, **kwargs): super(case, self).__init__(**kwargs) box = FloatLayout() graph = Graph(xlabel='X', ylabel='Y', x_ticks_minor=5, x_ticks_major=25, y_ticks_major=1, y_grid_label=True, x_grid_label=True, padding=5, x_grid=True, y_grid=True, xmin=-0, xmax=20, ymin=0, ymax=10) plot = LinePlot() # plot.points = [(x, sin(x / 10.)) for x in range(0, 101)] # data = np.array([[0,0], [1,1],[2,2]]) data = collections.deque(maxlen=20) time = collections.deque(maxlen=20) d = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) t = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) data.append(d) time.append(t) toplot = np.vstack((time, data)).T print toplot plot.points = tuple(map(tuple, toplot)) graph.add_plot(plot) box.add_widget(graph) self.add_widget(box)
def build(self): """Build all graphical elements. Returns: Build layout. """ self.text_city = TextInput(text='Please enter city', multiline=False, size_hint = (.6,.1), pos_hint ={'x': .1, 'y': .8}) button_city_input = Button(text="Enter", size_hint=(.2, .1), pos_hint={'x': .7, 'y': .8}) button_extract = Button(text="Extract", size_hint = (.2,.1), pos_hint ={'x': .1, 'y': .6}) button_transform = Button(text="Transform",size_hint = (.2,.1), pos_hint ={'x': .4, 'y': .6}) button_load = Button(text="Load", size_hint = (.2,.1), pos_hint ={'x': .7, 'y': .6}) button_complete = Button(text="Whole Process", size_hint = (.2,.1), pos_hint ={'x': .4, 'y': .4}) button_show_database_content = Button(text="Show Database", size_hint=(.2, .1), pos_hint={'x': .4, 'y': .2}) layout = FloatLayout() layout.add_widget(self.text_city) layout.add_widget(button_city_input) layout.add_widget(button_extract) layout.add_widget(button_transform) layout.add_widget(button_load) layout.add_widget(button_complete) layout.add_widget(button_show_database_content) button_complete.bind(on_press=self.on_complete) button_extract.bind(on_press=self.on_extract) button_load.bind(on_press=self.on_load) button_transform.bind(on_press=self.on_transform) button_city_input.bind(on_press=self.on_city_find) button_show_database_content.bind(on_press=self.on_show_database) load.loader.init_connection() scrapper.init_driver() self.tablepopup = Builder.load_file('ux/tablepopup.kv') self.citypopup = Builder.load_file('ux/citespopup.kv') return layout
def build(self): """ This method builds the GUI """ #initialize self.currentState = State() self.winner = -1 #array of buttons #so that we know which button is pressed and can change button text #when computer makes a move self.buttons = [] #we need to change it later self.winnerLabel = None #create layout layout = FloatLayout(size=(300, 300)) #find the width and height of the buttons colWidth = 0.75 / Config.nSquares rowHeight = 1.0 / Config.nSquares #create grid of buttons for i in range(Config.nSquares): for j in range(Config.nSquares): button = Button(text="-", size_hint=(colWidth, rowHeight), pos_hint={'x':colWidth * i, 'y':rowHeight * j}, font_size=60) button.bind(on_press = self.selectBox) layout.add_widget(button) #append buttons self.buttons.append(button) #winner label self.winnerLabel = Label(text = "Winner is", size_hint=(.25, 1), pos_hint={'x':.75, 'y':0.}, font_size=20) layout.add_widget(self.winnerLabel) #get first move in case of computer player goes first if Config.startPlayer == Config.computerPlayer: self.callComputerPlayer() return layout
def connect_to_folder(self, volume=''): layout = FloatLayout() folder_info = FileChooserListView(rootpath=volume, size_hint=(1, .75), pos_hint={ 'center_x': .5, 'center_y': .6 }) connect_btn = Button(text="Connect", size_hint=(.2, .1), pos_hint={ 'center_x': .25, 'center_y': .1 }) close_btn = Button(text="Cancel", size_hint=(.2, .1), pos_hint={ 'center_x': .75, 'center_y': .1 }) layout.add_widget(folder_info) layout.add_widget(connect_btn) layout.add_widget(close_btn) # Instantiate the modal popup and display popup = Popup(title='Folder connection', content=layout, size_hint=(1, 1)) popup.open() # Attach close button press with popup.dismiss action connect_btn.bind(on_release=lambda info: self.open_folder_window( path=folder_info.path)) self.folder_input = True close_btn.bind(on_press=popup.dismiss)
def build(self): # prepare shader list available_shaders = (shader_pulse, shader_postprocessing, shader_monochrome) self.shader_index = 0 # create our widget tree root = FloatLayout() sw = ShaderWidget() root.add_widget(sw) # add a button and scatter image inside the shader widget btn = Button(text='Hello world', size_hint=(None, None), pos_hint={ 'center_x': .25, 'center_y': .5 }) sw.add_widget(btn) center = Window.width * 0.75 - 256, Window.height * 0.5 - 256 scatter = ScatterImage(source='tex3.jpg', size_hint=(None, None), size=(512, 512), pos=center) sw.add_widget(scatter) # create a button outside the shader widget, to change the current used # shader btn = Button(text='Change fragment shader', size_hint=(1, None), height=50) def change(*largs): sw.fs = available_shaders[self.shader_index] self.shader_index = (self.shader_index + 1) % len(available_shaders) btn.bind(on_release=change) root.add_widget(btn) return root
def build(self): layout = FloatLayout() V24PowerLabel = MyLabel( text='24V Power', font_size=25, size_hint = (.33, .1), pos=(30,500), color=(0,0,0,1) ) HeadSensorLabel = MyLabel( text='Head Sensor Power', font_size=25, size_hint = (.33, .1), pos=(30,400), color=(0,0,0,1) ) V12PowerLabel = MyLabel( text='12V Power', font_size=25, size_hint = (.33, .1), pos=(450,500), color=(0,0,0,1) ) TrackerLabel = MyLabel( text='Tracker Power', font_size=25, size_hint = (.33, .1), pos=(450,400), color=(0,0,0,1) ) layout.add_widget(V24PowerLabel) layout.add_widget(HeadSensorLabel) layout.add_widget(V12PowerLabel) layout.add_widget(TrackerLabel) return layout
def build(self): Window.maximize() interface = FloatLayout() self.data = Data() self.frontpage = FrontPage(self.data, name='FrontPage') interface.add_widget(self.frontpage) self.nonVisibleWidgets = NonVisibleWidgets() ''' Load User Settings ''' self.data.comport = self.config.get('Maslow Settings', 'COMport') self.data.gcodeFile = self.config.get('Maslow Settings', 'openFile') offsetX = float(self.config.get('Advanced Settings', 'homeX')) offsetY = float(self.config.get('Advanced Settings', 'homeY')) self.data.gcodeShift = [offsetX, offsetY] self.data.config = self.config ''' Initializations ''' self.frontpage.setUpData(self.data) self.nonVisibleWidgets.setUpData(self.data) self.frontpage.gcodecanvas.initialize() ''' Scheduling ''' Clock.schedule_interval(self.runPeriodically, .01) ''' Push settings to machine ''' self.data.bind(connectionStatus=self.push_settings_to_machine) self.data.pushSettings = self.push_settings_to_machine self.push_settings_to_machine() return interface
def build(self): self.icon = 'memoIcon.png' self.title = 'Kivy Memory' global sounds,icons sounds,icons=loadData() #showmissingSounds() global MAX_NBITEMS MAX_NBITEMS = len(icons) items,level = self.loadLevel() g = MemoryLayout(rows=4,items = items, level=level,size_hint=(1,.9)) config = BoxLayout(orientation='horizontal',spacing=10, size_hint=(1,.1)) sound = ToggleButton(text='Sound On', size_hint=(0.15,1)) sound.bind(on_press=MemoryButton.toggleSound) pb = MyPb(max=items, size_hint=(0.55,1),ml=g) score = LabelScore(text="Time: 0 s",size_hint=(0.15,1)) missed = LabelMissed(text="Missed: 0",size_hint=(0.15,1)) config.add_widget(pb) config.add_widget(score) config.add_widget(missed) config.add_widget(sound) g.bind(missed=missed.update) g.bind(elapsed=score.updateTime) g.bind(left=pb.foundAnItem) g.bind(items=pb.newNbItems) playZone = BoxLayout(orientation='vertical') playZone.add_widget(g) playZone.add_widget(config) root=FloatLayout() root.add_widget(Image(source='Jungle_Background_-_by-vectorjungle.jpg',allow_stretch=True,keep_ratio=False)) root.add_widget(playZone) #Clock.schedule_interval(g.initialCountdown,1) Clock.schedule_once(g.startGame,3) return root
def __init__(self, **kwargs): super(w3, self).__init__(**kwargs) l1 = FloatLayout() self.add_widget(l1) b1 = Button(text="Trackpad", font_size=20, size_hint=(0.3, 0.2), pos_hint={ "x": 0.35, "top": 0.9 }, background_color=[0, 1, 0, 0.5], color=[0.929, 0.961, 0.882, 1], bold=True, on_press=self.change_to_game_tpad) b2 = Button(text="External Mouse", font_size=20, size_hint=(0.3, 0.2), pos_hint={ "x": 0.35, "top": 0.6 }, background_color=[0, 0, 1, 0.7], color=[0.929, 0.961, 0.882, 1], bold=True, on_press=self.change_to_game_mouse) b3 = Button(text="Touch", font_size=20, size_hint=(0.3, 0.2), pos_hint={ "x": 0.35, "top": 0.3 }, background_color=[255, 0, 0, 0.7], color=[0.929, 0.961, 0.882, 1], bold=True, on_press=self.change_to_game_touch) l1.add_widget(b1) l1.add_widget(b2) l1.add_widget(b3)
def exitoP(self): box = FloatLayout(size=(300, 300)) label = Label(text='Transacción Exitosa', pos_hint={'x': 0, 'y': 0.2}) btn1 = Button(text="Aceptar", size_hint=(0.5, 0.3), pos_hint={ 'center_x': 0.5, 'center_y': 0.2 }) box.add_widget(label) box.add_widget(btn1) popup = Popup(title='¡Datos Correctos!', title_size=(20), title_align='center', content=box, size_hint=(None, None), size=(280, 180), auto_dismiss=True) btn1.bind(on_press=popup.dismiss) popup.open() self.popup = popup
def verify(self): z=False cur.execute("select * from employee") f=cur.fetchall() for rows in f: if self.ids["uname"].text==rows[0] and self.ids["passw"].text==rows[10] and self.ids["bid"].text==rows[8]: z=True self.manager.current='menu' break if self.ids["uname"].text=="admin" and self.ids["passw"].text=="admin": z=True self.manager.current="adscr" break if z==False: box = FloatLayout() box.add_widget(Label(text="Invalid Username or Password",pos_hint={'center_x':0.5,'center_y':0.8},font_size=20)) btn1 = Button(text="Close",size_hint=(1/3,1/5),pos_hint={'center_x':0.5,'center_y':0.2}) box.add_widget(btn1) popup =Popup(title='Error!', title_size=(30), content=box,size_hint=(1/2,1/2), size=(400, 400),auto_dismiss=False) btn1.bind(on_press=popup.dismiss) popup.open()
def build(self): root = FloatLayout() layer = GridLayout(rows = 2) cameraview = CameraView(resolution = (640, 480), play = True) graphview = GraphView() #graphview2 = GraphView_2() blankview = BlankView() layer.add_widget(graphview) layer.add_widget(blankview) #layer.add_widget(graphview2) Clock.schedule_interval(graphview.update, 1/5) #Clock.schedule_interval(graphview2.update, 1/5) root.add_widget(cameraview) root.add_widget(layer) return root
def __init__(self, **kwargs): super(Task, self).__init__(**kwargs) self.avatar = FloatLayout( size=(166, 139) ) avatar_photo = Image( source=constants.avatar_fn, size=(100,100), pos=(self.avatar.size[0]/2-50, self.avatar.size[1]/2-50) ) avatar_background = RoundedRectangle( pos=(0,0), size=self.avatar.size, radius=[(10, 10), (10, 10), (10, 10), (10, 10)] ) self.avatar.add_widget(avatar_background) self.avatar.add_widget(avatar_photo) self.add_widget(self.avatar)
def __init__(self, **kwargs): super().__init__(**kwargs) self.layout = FloatLayout() self.add_widget(self.layout) # background self.img = Image(source='images/account.jpg', allow_stretch=True, keep_ratio=False) # button self.bt = Button(size_hint=(None,None), size=(267,82), pos=(389,350), opacity=0) # loading widgets self.layout.add_widget(self.img) self.bt.bind(on_press=self.change_screen) self.layout.add_widget(self.bt)
def build(self): self.img1 = Image(size_hint=(1, 1)) self.btn = Button(background_normal='pic3.png', background_down='pic3.png', on_release=self.take, size_hint=(.4, .2), pos_hint={ 'x': 0.35, 'y': 0 }) layout = FloatLayout(size=(800, 450), pos_hint={ 'center_y': 0.5, 'center_x': 0.5 }) layout.add_widget(self.img1) layout.add_widget(self.btn) os.chdir('./images') self.capture = cv2.VideoCapture(0) Clock.schedule_interval(self.update, 1.0 / 33.0) return layout
def __init__(self, **Kwargs): super(Salas, self).__init__(**Kwargs) self.orientation = "vertical" S = Image(source='imagenes/fondoRojo.jpeg', allow_stretch=True) self.add_widget(S) #añade la imagen al widget my_box1 = FloatLayout(size=(300, 300)) btnEntrar = Button(text="Entrar a una sala", size_hint=(.3, .1), font_size=24, background_color=[0, 1, 0.6, 0.8], pos=(150, 300)) btnEntrar.bind(on_press=self.changerEntrar) btnCrear = Button(text="Crear una sala", size_hint=(.3, .1), font_size=24, background_color=[0, 1, 0.6, 0.8], pos=(150, 200)) btnCrear.bind(on_press=self.changerCrear) my_box1.add_widget(btnEntrar) my_box1.add_widget(btnCrear) self.add_widget(my_box1)
def build(self): self.look_at = Vector3(0, 0, -1) root = FloatLayout() self.renderer = Renderer(shader_file=shader_file) scene = Scene() self.camera = PerspectiveCamera(75, 1, 1, 1000) self.camera.pos.z = 5 loader = OBJMTLLoader() obj = loader.load(obj_file, mtl_file) self._keyboard = Window.request_keyboard(self._keyboard_closed, self) self._keyboard.bind(on_key_down=self._on_keyboard_down) scene.add(*obj.children) self.renderer.render(scene, self.camera) self.orion = scene.children[0] root.add_widget(self.renderer) self.renderer.bind(size=self._adjust_aspect) Clock.schedule_interval(self._rotate_obj, 1 / 20) return root
def build(self): root = FloatLayout() b = GridLayout(cols=1, pos_hint={ 'center_x': .5, 'center_y': .5 }, size_hint=(None, None), spacing=20, width=200) b.bind(minimum_height=b.setter('height')) root.add_widget(b) for text_lenght in range(0, 80, 20): l = Label(text='word ' * text_lenght, size_hint_y=None) l.bind(width=lambda s, w: s.setter('text_size')(s, (w, None))) l.bind(texture_size=l.setter('size')) b.add_widget(l) return root
def __init__(self, **kwargs): super(ScreenOne, self).__init__(**kwargs) my_box = FloatLayout(orientation='vertical') button1 = Button(text="To the next screen", color=[1, 1, 1, 1], size_hint_y=0.1, size_hint_x=1, pos_hint={ 'x': 0, 'y': 0.9 }) button1.bind(on_press=self.screen_changer1) label = Label(text='Hello PyThess', font_size='40sp', pos_hint={ 'x': 0, 'y': 0.3 }) my_box.add_widget(button1) my_box.add_widget(label) self.add_widget(my_box)
def build(self): self.main_layout2 = FloatLayout(size=(50, 50)) obj = itemslist() self.item = obj.get() string = 'Total number of records are :\n-------------> %s' % (len(self.item)) label1 = Label(text=string, font_size=55, size_hint=(.20, .10), pos_hint={'x': .40, 'y': .70}) self.main_layout2.add_widget(label1) button1 = Button( text='Ok', size_hint=(.15, .10), pos_hint={'x': .45, 'y': .30} ) button1.bind(on_press=self.ok) self.main_layout2.add_widget(button1) return self.main_layout2
def show_im(self): im_d = ImDisplay(size_hint=(1., 1.)) imtest1 = tifffile.imread('example_im.tif') imtest1 = imtest1.astype(float) #imtest2 = numpy.zeros((500, 500)) #for i in range(500): # imtest2[:, i] = i/2 im_d.create_im(imtest1, 'PastelHeat') self.m_layout = FloatLayout(size=(Window.width, Window.height)) with self.canvas: self.add_widget(self.m_layout) self.m_layout.add_widget(im_d) im_d.update_im(imtest1)
def Ready(): # Clear screen to prevent text-on-text situation readyscreen.clear_widgets() Ready.layout = FloatLayout(size=(300, 300)) Ready.label = Label(text="", size_hint=(0.5, 0.1), pos_hint={ "x": 0.25, "y": 0.6 }) Ready.back = Button(text=_("Back"), size_hint=(0.5, 0.1), pos_hint={ "x": 0.25, "y": 0.8 }) Ready.back.bind(on_release=partial(changeScreen, "Making")) Ready.layout.add_widget(Ready.label) readyscreen.add_widget(Ready.layout)
def build(self): #titre self.title = 'manaRpg' #taille de l'écran Window.size=(ex, ey) self.content = FloatLayout(size_hint=(None, None),size=(ex, ey)) self.anim_image = Image(source = 'dot_26x26.png',size_hint=(None,None),size=(26,26),pos=(30,200)) self.anim_button = Button(on_press=self.testAnimation,size_hint=(None,None),size=(120,20),pos=(0,0),text="animation") self.rota_button = Button(on_press=self.rotation,size_hint=(None,None),size=(120,20),pos=(130,0),text="rotation") self.content.add_widget(self.anim_image) self.content.add_widget(self.anim_button) self.content.add_widget(self.rota_button) self.sprite = Image(source = "atlas://invader/id1",size_hint=(None,None),size=(32,32),pos=(40,150)) self.content.add_widget(self.sprite) self.temps = 0 self.imgSprite1 = 1 self.dirSprite1 = 1 Clock.schedule_interval(partial(self.animeSprite,24,2), 1.0/60.0) return self.content
def build(self): layout = FloatLayout(size=(500, 700)) label1 = Label(text='[color=00000]Reset Password[/color]', size_hint=(.25, .25), pos=(193, 550), markup=True) layout.add_widget(label1) label2 = Label(text='[color=00000]Username/E-mail[/color]', size_hint=(.25, .25), pos=(30, 500), markup=True) layout.add_widget(label2) text1 = TextInput(text='Enter username/email', size_hint=(.9, .05), pos=(25, 540)) layout.add_widget(text1) btn1 = Button(text='Link boat to account', size_hint=(.4, .05), pos=(153, 470)) layout.add_widget(btn1) return layout