def add_widgets(self, root): self.settings_popup.ok.bind(on_press=self.re_build) page = PageLayout(border=30, swipe_threshold=0.2) p1 = BoxLayout(orientation='horizontal', background_color=[1, 1, 1, 1]) p1.add_widget(self.settings_popup.specimen.eps_sig_wid) p1.add_widget(self.settings_popup.specimen.f_u_wid) page.add_widget(p1) p2 = BoxLayout(orientation='horizontal', background_color=[1, 1, 1, 1]) p2.add_widget(self.settings_popup.specimen.disp_slip_wid) p2.add_widget(self.settings_popup.specimen.shear_flow_wid) page.add_widget(p2) upper = BoxLayout(orientation='horizontal', size_hint=(1, 0.7)) upper.add_widget(page) root.add_widget(upper) btns = BoxLayout(orientation='horizontal', size_hint=(1, 0.1)) settings = Button(text='Settings') settings.bind(on_press=self.settings_popup.open) reset = Button(text='Reset') reset.bind(on_press=self.settings_popup.reset) btns.add_widget(Label()) btns.add_widget(Label()) btns.add_widget(settings) btns.add_widget(reset) root.add_widget(self.settings_popup.specimen) root.add_widget(btns)
def __init__(self,**kwargs): super(StoryScreen,self).__init__(**kwargs) self.layout = PageLayout() #a nice layout to display instructions self.setPages() #set all pages in the pagelayout self.back_button = Button(pos_hint={'right':.9,'top':.2}, size_hint=(.08,.1067),background_normal='img/back_t.png', background_down='img/back_down.png') self.back_button.bind(on_release=self.return_func) self.add_widget(self.back_button)
def downbut(self): global url global s url =self.textin.text self.box = PageLayout() video=pafy.new(url) self.box.add_widget(Label(text='Swipe Left To See The Description')) self.box.add_widget(Image(source='a.png')) self.box.add_widget(Button(text='Title '+str(video.title)+'\nRating '+str(video.rating)+'\nViews '+str(video.viewcount)+'\nAuthor '+str(video.author)+'\nLength '+str(video.length)+' seconds\nCategory '+str(video.category),background_color=(1.0, 1.0, 0.0, 1))) self.box.add_widget(Button(text='Yes:-This is my video',background_color=(0.81, 0.27, 0.33, 1),on_press= lambda *args: self.popup.dismiss())) self.box.add_widget(Button(text='No:-This is not my video',background_color=(1.0, 0.0, 0.0, 1.0),on_press=lambda *args:App.get_running_app().stop())) self.popup = Popup(title='Discription of the video', content=self.box, auto_dismiss=False) self.popup.open()
def __init__(self, playerHub): PageLayout.__init__(self) self.playerHub = playerHub # Std values self.bot1 = 0 self.bot2 = 0 self.isTraining = False self.qLabels = self.getIDsFromQLabels() # For Keyboard shortcuts self.keyboard = Window.request_keyboard(self.keyboard_closed, self) self.keyboard.bind(on_key_down=self.on_keyboard_down)
class Kniha(PageLayout): def __init__(self, nazev, *args, **kwargs): super(Kniha, self).__init__(*args, **kwargs) #Vytvoříme obal, který bude vše držet pospolu self.obal_layout = BoxLayout(orientation="vertical") #Vytvoříme si obal pro knížku self.layout = PageLayout(size_hint=(1, .9)) #Vytvoříme si stránku self.strana1 = BoxLayout(orientation="vertical") #Přidáme barvu do canvasu self.strana1.canvas.before.add(Color(rgba=(0.5, 0, 0.5, 1))) #Přidáme čtverec do canvasu self.ctverec1 = Rectangle(size=self.strana1.size, pos=self.strana1.pos) self.strana1.canvas.before.add(self.ctverec1) #Přidáme Label, který se zobrazí na stránce self.strana1.add_widget(Label(text=nazev)) #Vytvoříme si stránku self.strana2 = BoxLayout(orientation="vertical") #Přidáme barvu do canvasu self.strana2.canvas.before.add(Color(rgba=(0.5, 0.5, 0, 1))) #Přidáme čtverec do canvasu self.ctverec2 = Rectangle(size=self.strana2.size, pos=self.strana2.pos) self.strana2.canvas.before.add(self.ctverec2) #Přidáme Label, který se zobrazí na stránce self.strana2.add_widget(Label(text="Strana")) #Přídáme strany do PageLayoutu a ten přídáme do obalu self.layout.add_widget(self.strana1) self.layout.add_widget(self.strana2) self.obal_layout.add_widget(self.layout) #ZDE BUDE OVLÁDACÍ PANEL self.add_widget(self.obal_layout) self.strana1.bind(size=self.update, pos=self.update) self.strana2.bind(size=self.update, pos=self.update) def update(self, *args): self.ctverec1.size = self.size self.ctverec1.pos = self.strana1.pos self.ctverec2.size = self.size self.ctverec2.pos = self.strana2.pos
def build(self): #for fullscreen use Window.fullscreen = 'auto' #for window use #Window.borderless = '0' #Window.size = (1920,1080) #Window.clearcolor = (0.1,0.1,0.1,1) #layout setup pageslay = PageLayout(border="20") Page1 = GraphPage('IBM') Page2 = GraphPage('AAPL') Page3 = GraphPage('BINANCE:BTCUSDT') pages = [Page1, Page2, Page3] pageslay.add_widget(Page1.getWidget()) pageslay.add_widget(Page2.getWidget()) pageslay.add_widget(Page3.getWidget()) def update(rap): gjruihfdhusi = [] for page in pages: gjruihfdhusi.append( asyncio.run(page.getchart().get_point_data())) #print(gjruihfdhusi)[1] #for some reason i couldn't get a classes method to run in schedule_interval Clock.schedule_interval(update, 1 / 30) return pageslay
def build(self): layout = PageLayout() layout.add_widget(Button(text='1st', background_color=(1, 0, 0, 1))) layout.add_widget(Button(text='2nd', background_color=(0, 1, 0, 1))) layout.add_widget(Button(text='3rd', background_color=(1, 1, 1, 1))) layout.add_widget(Button(text='4th', background_color=(0, 1, 1, 1))) return layout
def build(self): #for fullscreen use #Window.fullscreen = 'auto' #for window use #Window.borderless = '0' Window.size = (1280, 720) #Window.clearcolor = (0.1,0.1,0.1,1) #layout setup tickers = ['IBM', 'AAPL', 'BINANCE:BTCUSDT'] pages = [] pageslay = PageLayout(border="20") for i in range(len(tickers)): pages.append(GraphPage(tickers[i])) for i in range(len(pages)): pageslay.add_widget(pages[i].getWidget()) requer = reqhelp.helper() for ticker in tickers: requer.addtotargets(ticker) requer.start() def update(*rap): for page in pages: data = requer.getdata(page.getTicker()) if data != 0: page.getchart().update(data) page.Currentpricelabel.text = f'Current Quote:\n {str(round(page.getchart().CurrentPrice,2))}' Clock.schedule_interval(update, 1 / 30) return pageslay
def build(self): #self.load_kv('MyApp.kv') self.title = "Graphic Test Framework" widget = MyWidget() widget.add_widget(Label(text="prueba")) myCanvas = Canvas() myCanvas.add(Rectangle(size=(350, 1), pos=(0, 500))) widget.canvas = myCanvas widget.add_widget(Button(text="Boton", pos=(100, 500))) return widget return MyWidget() return PageLayout() return StackLayout() return BoxLayout() return GridLayout() return FloatLayout() return CustomWidget()
def build(self): """ build function here """ layout = GridLayout(cols=2) button_lightON = Button(text="Light ON", background_color=red) button_lightOFF = Button(text="Light OFF", background_color=green) button_fanON = Button(text="Fan ON", background_color=blue) button_fanOFF = Button(text="Fan OFF", background_color=purple) button_ledON = Button(text="LED ON", background_color=red) button_ledOFF = Button(text="LED OFF", background_color=green) layout.add_widget(button_lightON) layout.add_widget(button_lightOFF) layout.add_widget(button_fanON) layout.add_widget(button_fanOFF) layout.add_widget(button_ledON) layout.add_widget(button_ledOFF) return PageLayout()
def build(self): duzen = PageLayout() page1 = BoxLayout(orientation="vertical") page1a = BoxLayout(orientation="vertical", padding=[100, 10, 500, 10], size_hint=(1, 0.5), spacing=5) buton1 = Button(text="Log In") buton2 = Button(text='Quit') label1 = Label(text="") label2 = Label(text="") page1a.add_widget(buton1) page1a.add_widget(buton2) page1.add_widget(label1) page1.add_widget(page1a) page1.add_widget(label2) duzen.add_widget(page1) page2 = BoxLayout(orientation="vertical") page2a = GridLayout(rows=3, padding=[10, 10, 200, 10], size_hint=(1, 0.7), spacing=5) but1 = Button(text="Log In") lab1 = Label(text="User", size_hint=(1, 1)) lab2 = Label(text="Password", size_hint=(1, 1)) lab3 = Label(text="") lab4 = Label(text="") lab5 = Label(text="") tex1 = TextInput() tex2 = TextInput() page2a.add_widget(lab1) page2a.add_widget(tex2) page2a.add_widget(lab2) page2a.add_widget(tex1) page2a.add_widget(lab3) page2a.add_widget(but1) page2.add_widget(lab4) page2.add_widget(page2a) page2.add_widget(lab5) duzen.add_widget(page2) return duzen
def build(self): return PageLayout()
'Col5': [random.random() for x in range(10)] } from kivy.base import runTouchApp from kivy.uix.pagelayout import PageLayout from kivy.factory import Factory Builder.load_string(""" <Page@AnchorLayout>: canvas.before: Color: rgba: 0, 0, 0, 1 Rectangle: pos: self.pos size: self.size """) pg = PageLayout() staticpage = Factory.Page(name='static') staticpage.add_widget( DataTable(name='static', data=data, header_column='Col1', header_row=['Col' + str(x + 1) for x in xrange(5)])) editpage = Factory.Page(name='edit') editpage.add_widget( DataTable(name='edit', data=data, header_column='Col5', header_row=['Col' + str(5 - x) for x in xrange(5)], editable=True)) pg.add_widget(staticpage) pg.add_widget(editpage)
class Programx(App): def build(self): self.mainFrame = PageLayout() self.page1BL = BoxLayout() self.page2BL = BoxLayout() #################### PAGE 1 ################################ self.mainFramePG1 = FloatLayout( ) # Elemanların hepsini tutan ana pencere düzenimiz self.login = BoxLayout() self.quit = BoxLayout() self.login_buton = Button(background_color=(.6, .4, .8, 1), text="Login", size_hint=(.2, .1), pos_hint={ 'x': .2, 'y': .44 }) self.quit_buton = Button(background_color=(.6, .4, .8, 1), text="Quit", size_hint=(.2, .1), pos_hint={ 'x': .2, 'y': .56 }) # Şimdi hepsini ana düzene yerleştiriyoruz self.mainFramePG1.add_widget(self.login) self.mainFramePG1.add_widget(self.quit) self.mainFramePG1.add_widget(self.login_buton) self.mainFramePG1.add_widget(self.quit_buton) ################## PAGE 2 ############################## self.mainFramePG2 = BoxLayout( orientation="vertical", size_hint=(.5, .25), pos_hint={ 'x': .15, 'y': .4 }) # Elemanların hepsini tutan ana pencere düzenimiz self.user = BoxLayout() self.password = BoxLayout() self.login = BoxLayout() self.userLabel = Label(text="Username", size_hint=(.4, .95)) self.userInput = TextInput(size_hint=(.6, .95)) self.user.add_widget(self.userLabel) self.user.add_widget(self.userInput) self.passwordLabel = Label(text="Password", size_hint=(.4, .95)) self.passwordInput = TextInput(size_hint=(.6, .95)) self.password.add_widget(self.passwordLabel) self.password.add_widget(self.passwordInput) self.loginLabel = Label(size_hint=(.4, .9)) self.login_buton = Button(background_color=(.6, .4, .8, 1), text="Login", size_hint=(.6, .9)) self.login.add_widget(self.loginLabel) self.login.add_widget(self.login_buton) # Şimdi hepsini ana düzene yerleştiriyoruz self.mainFramePG2.add_widget(self.user) self.mainFramePG2.add_widget(self.password) self.mainFramePG2.add_widget(self.login) self.page1BL.add_widget(self.mainFramePG1) self.page2BL.add_widget(self.mainFramePG2) self.mainFrame.add_widget(self.page1BL) self.mainFrame.add_widget(self.page2BL) return self.mainFrame
class StoryScreen(Screen): #where the tutoral is def __init__(self,**kwargs): super(StoryScreen,self).__init__(**kwargs) self.layout = PageLayout() #a nice layout to display instructions self.setPages() #set all pages in the pagelayout self.back_button = Button(pos_hint={'right':.9,'top':.2}, size_hint=(.08,.1067),background_normal='img/back_t.png', background_down='img/back_down.png') self.back_button.bind(on_release=self.return_func) self.add_widget(self.back_button) def loadPlayerPage(self): #initiate the images&buttons for NT selection self.player_1_img = Image(source='img/pair1.png', pos_hint={"center_x":.3,"center_y":.7}) self.player_1 = ToggleButton(state="down",group='NT', background_normal='img/select_normal.png', background_down='img/select_down.png',allow_no_selection=False, pos_hint={"center_x":.7,"center_y":.7}, size_hint=(218/cwidth,77/cheight)) self.player_2_img = Image(source='img/pair2.png', pos_hint={"center_x":.3,"center_y":.5}) self.player_2 = ToggleButton(state="normal",group='NT', background_normal='img/select_normal.png', background_down='img/select_down.png',allow_no_selection=False ,pos_hint={"center_x":.7,"center_y":.5}, size_hint=(218/cwidth,77/cheight)) self.player_3_img = Image(source='img/pair3.png', pos_hint={"center_x":.3,"center_y":.3}) self.player_3 = ToggleButton(state="normal",group='NT', background_normal='img/select_normal.png', background_down='img/select_down.png',allow_no_selection=False, pos_hint={"center_x":.7,"center_y":.3}, size_hint=(218/cwidth,77/cheight)) def PlayerPage(self): #create the first page self.loadPlayerPage() NT_select = FloatLayout() self.player_1.bind(state=self.callback_1) #change the NT for the game self.player_2.bind(state=self.callback_2) self.player_3.bind(state=self.callback_3) NT_select.add_widget(self.player_1_img) NT_select.add_widget(self.player_1) NT_select.add_widget(self.player_2_img) NT_select.add_widget(self.player_2) NT_select.add_widget(self.player_3_img) NT_select.add_widget(self.player_3) self.layout.add_widget(NT_select) def setPages(self): #set all other pages (simple image) self.PlayerPage() #three pages - basic, special, and mode #only one widget allowed on a page basic = Button(background_normal='img/basic_t.png', background_down='img/basic_t.png') special = Button(background_normal='img/special_t.png', background_down='img/special_t.png') mode = Button(background_normal='img/mode_t.png', background_down='img/mode_t.png') self.layout.add_widget(basic) self.layout.add_widget(special) self.layout.add_widget(mode) self.add_widget(self.layout) #the following methods uses the NumericProperty of Kivy #which would call a defined function every time the value changes def callback_1(self,instance,value): global SelectNT if value=="down": selected.SelectNT = 1 def callback_2(self,instance,value): global SelectNT if value=="down": selected.SelectNT = 2 def callback_3(self,instance,value): global SelectNT if value=="down": selected.SelectNT = 3 def on_pre_enter(self): #record current screen for back func home.prevScreen.append("story") def return_func(self,instance): self.manager.transition.direction='right' self.manager.current="home"
def build(self): def set_hand_hist_button(instance): print(self.webcam_permission) #get_hand_hist(self.webcam_permission) # for pop up if get_hand_hist(self.webcam_permission) == 'No permission Given': wbcpermission_popup.open() def on_wbcpermission_active(checkbox, value): if value: #print('The checkbox', checkbox, 'is active') self.webcam_permission = True else: #print('The checkbox', checkbox, 'is inactive') self.webcam_permission = False def fun_util_button(instance): #pass recognize() def show_gestures_function(instance): img = cv.imread(os.path.join(sys.path[0], "full_img.jpg")) cv.imshow("Recognizable gestures", img) wbcpermission_popup = Popup( title='Permission Denied', content=Label( text='Give Webcam Permission before proceeding further.'), size_hint=(None, None), size=(400, 400)) main_layout = PageLayout() # Page 1-----SETTING UP HAND HIST layout1 = BoxLayout(orientation='horizontal', padding=2) # with layout1.canvas: # Color(45/255,20/255,44/255) # Rectangle(pos=(0, 0), size=Window.size) layout2 = BoxLayout(orientation='vertical', spacing=10, padding=2) btn = Button(text='Set Your Hand histogram.', background_color=(128 / 255, 19 / 255, 54 / 255, 1), size_hint=(1, 1), background_normal='') l = Button(text=""" INSTRUCTIONS FOR SETTING THE HAND HISTOGRAM 1. Allow webcam permission by clicking the checkbox on your bottom right and then press the button on the top left. 2. A window will appear with 50 squares (5x10). 3. Put your hand in those squares. Make sure your hand covers all the squares. 4. Press 'c'. One other window will appear "Thresh" showing only white patches corresponding to the parts of the image which has your skin color. 5. In case you are not successful then move your hand a little bit and press 'c' again. Repeat this until you get a good histogram. 6. After you get a good histogram press 's' to save the histogram. All the windows close. 7. Swipe to the next page when you are done""", color=(238 / 255, 69 / 255, 64 / 255, 1), background_color=(45 / 255, 20 / 255, 44 / 255, 1), background_normal='', background_down='') webcam_permission_checkbox = CheckBox() webcam_permission_checkbox.bind(active=on_wbcpermission_active) btn.bind(on_press=set_hand_hist_button) layout2.add_widget(btn) layout2.add_widget(webcam_permission_checkbox) layout1.add_widget(layout2) #layout1.add_widget(webcam_permission_checkbox) layout1.add_widget(l) main_layout.add_widget(layout1) # Page 2------ RECOGNIZING GESTURES layout3 = BoxLayout(orientation='horizontal', padding=2) layout4 = BoxLayout(orientation='vertical', spacing=10, padding=2) l1 = Button(text=""" INSTRUCTIONS FOR MAKING GESTURES 1. The accuracy of recognized gesture depends upon the histogram made so please set an accurate histogram. 2. Press the button on the left to open the application window. 3. Make your gesture inside the neon-green space provided. 4. Hold the gesture for '15 frames' inorder to get it displayed on the screen. 5. Check upon the thresh window in order to make better gestures. 6. Indorder to stop the recognition process press the key 's' from your keyboard. 7. Once the recognition is stopped close the recognition tabs. """, color=(238 / 255, 69 / 255, 64 / 255, 1), background_color=(45 / 255, 20 / 255, 44 / 255, 1), background_normal='', background_down='') fun_util_buttonn = Button(text='Press here', background_color=(81 / 255, 10 / 255, 50 / 255, 1), size_hint=(1, 1), background_normal='') show_gestures = Button(text='Show Recognizable Gestures', background_color=(81 / 255, 10 / 255, 50 / 255, 1), size_hint=(1, 1), background_normal='') fun_util_buttonn.bind(on_press=fun_util_button) show_gestures.bind(on_press=show_gestures_function) layout4.add_widget(fun_util_buttonn) layout4.add_widget(show_gestures) layout3.add_widget(layout4) layout3.add_widget(l1) main_layout.add_widget(layout3) main_layout.add_widget( Button(text=""" PROJECT DEVELOPED BY Umang Sharma 101983043 Suryansh Bhardwaj 101983044 Prakhar Srivastava 101983045 Students of 3COE20 Under the guidance of Komal Gill """, color=(1, 1, 1, 1), background_color=(199 / 255, 44 / 255, 65 / 255, 1), background_normal='', background_down='')) return main_layout
def build(self): # We're going to use the PageLayout now. return PageLayout()
def build(self): self.title = 'Big Bang Factory' #--:Initiating plot pan self.fig, self.ax, self.canvas = self.PlotPan() self.fig0, self.ax0, self.canvas0 = self.PlotPan() #--: Home Page self.img = mpimg.imread('BBF_frontpage.png') self.ax.imshow(self.img) self.anim_running = True self.anim_compare = True self.settings_running = True self.lensing_running = True #--: Widgets btn_user = IconButton(source='./icons/user.png', text='', size_hint_x=None, width=50) btn_user.bind(on_release=self.show_popup_user) btn_sim = IconButton(source='./icons/sim.png', size_hint_x=None, width=50) btn_sim.bind(on_release=self.show_popup_sim) btn_lens = IconButton(source='./icons/lens.png', size_hint_x=None, width=50) btn_lens.bind(on_release=self.lensing_icons) btn_settings = IconButton(source='./icons/settings.png', size_hint_x=None, width=50) btn_settings.bind(on_release=self.settings_icons) btn_home = IconButton(source='./icons/home.png', size_hint_x=None, width=50) btn_home.bind(on_release=self.clean) self.btn_pause = IconButton(source='./icons/pause.png', size_hint_x=None, width=50) self.btn_pause.bind(on_press=self.pause) self.btn_compare = IconButton(source='./icons/compare.ico', size_hint_x=None, width=50) self.btn_compare.bind(on_press=self.compare) self.btn_stop = IconButton(source='./icons/stop.png', size_hint_x=None, width=50) self.btn_stop.bind(on_press=self.sim_stop) self.btn_sim_save = IconButton(source='./icons/save.png', size_hint_x=None, width=50) self.btn_sim_save.bind(on_release=self.save_movie) self.btn_send = IconButton(source='./icons/send.ico', size_hint_x=None, width=50) self.btn_send.bind(on_release=self.send_movie) self.btn_database = IconButton(source='./icons/database.png', size_hint_x=None, width=50) self.btn_database.bind(on_release=self.show_popup_simselect) self.btn_savedir = IconButton(source='./icons/savedir.png', size_hint_x=None, width=50) self.btn_savedir.bind(on_release=self.show_popup_dirselect) self.btn_halo = IconButton(source='./icons/halo.png', size_hint_x=None, width=50) self.btn_halo.bind(on_release=self.HaloLensedImage) self.btn_cluster = IconButton(source='./icons/cluster.gif', size_hint_x=None, width=50) self.btn_cluster.bind(on_release=self.MapLensedImage) self.slider_comdist = Slider(min=0.0, max=100.0, value=10.0, step=10.0, orientation='horizontal', value_track=True, value_track_color=[1, 0, 0, 1], size_hint_x=None, width=150) #--:Page Layout #--- Page 1 Pages = PageLayout(orientation="vertical") self.Box_sim = BoxLayout(orientation="horizontal") self.Box_sim.add_widget(self.canvas) self.label_status = Label(text='Welcome to BBF', size_hint_y=None, height='28dp') self.BigBox_sim = BoxLayout(orientation="vertical") self.BigBox_sim.add_widget(self.Box_sim) self.BigBox_sim.add_widget(self.label_status) Pages.add_widget(self.BigBox_sim) #--- Page 2 self.Settings_Page = GridLayout(cols=1, row_force_default=True, row_default_height=40) self.subSettings_Page = GridLayout(cols=1, row_force_default=True, row_default_height=40) self.Settings_Page.add_widget(btn_user) self.Settings_Page.add_widget(btn_sim) self.Settings_Page.add_widget(btn_lens) self.Settings_Page.add_widget(btn_settings) self.Settings_Page.add_widget(self.btn_send) self.Settings_Page.add_widget(btn_home) self.Box_icons = BoxLayout(orientation='vertical') self.Box_icons.add_widget(self.Settings_Page) self.Box_icons.add_widget(self.subSettings_Page) Pages.add_widget(self.Box_icons) return Pages
#detector de eventos - se usara para crear efectos personalizados kivy.require('1.9.1') Window.clearcolor = (0, 0.2, 0.4,1) #home home = GridLayout(cols=3,spacing=[10,10],padding=[10,10]) home.orientation = 'vertical' #libreria libreria = GridLayout(cols=2,spacing=[10,10],padding=[10,10]) libreria.orientation = 'vertical' #widget contenedor raiz principal=PageLayout(cols=2,spacing=[10,10],padding=[10,10]) principal.orientation = 'vertical' #barra lateral barra_lateral=GridLayout(cols=2) #estante class tabbed_panel(TabbedPanel): pass estante=tabbed_panel() estante.default_tab_text = 'Recientes' #instancias de materias materias materias=[] #cajon