当前位置: 首页>>代码示例>>Python>>正文


Python slider.Slider类代码示例

本文整理汇总了Python中kivy.uix.slider.Slider的典型用法代码示例。如果您正苦于以下问题:Python Slider类的具体用法?Python Slider怎么用?Python Slider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Slider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SliderulMeu

class SliderulMeu(GridLayout):

    def __init__(self, **kwargs):
        super(SliderulMeu, self).__init__(**kwargs)
        self.cols = 1
        self.padding = 150
        self.toggle1 = ToggleButton(text="muzica")
        self.toggle1.background_normal = "on.png"
        self.toggle1.background_down = "off.png"
        self.add_widget(self.toggle1)
        self.arata_volum = Label (text = "volum: 10")
        self.add_widget(self.arata_volum)
        self.slide_muzica = Slider(min=0, max=100, value=10)
        self.slide_muzica.step = 5
        self.slide_muzica.orientation="horizontal" # alte optiuni 'vertical'
        self.add_widget(self.slide_muzica)
        self.toggle1.bind(on_press=self.dezactiveaza_volum)
        self.slide_muzica.bind(value=self.valoare_volum)

    def valoare_volum (self,x,y):
        '''utilziat pentru a vedea volumul'''
        self.arata_volum.text = "volum: "+str(int(self.slide_muzica.value))
        
    def dezactiveaza_volum (self,x):
        '''utilziat pentru a acctiva sau a dezactiva slider-ul'''
        if (self.toggle1.state == "down") :
            self.slide_muzica.disabled =True
        else:
            self.slide_muzica.disabled =False
            self.slide_muzica.value = 0
开发者ID:afodor88,项目名称:curs_python,代码行数:30,代码来源:slider2.py

示例2: build

 def build(self): #UIの構築等
     self._cap = cv2.VideoCapture(0)
     # ButtonやSlider等は基本size_hintでサイズ比率を指定(絶対値の時はNoneでsize=)
     # 日本語フォントを使いたいときはfont_nameでフォントへのパス
     kvButton1 = Button(text='ボタン', size_hint=(1.0, 0.1), font_name='/usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/ipag.ttf')
     kvButton1.bind(on_press = self.buttonCallback) #bindでイベントごとにコールバック指定
     # Imageに後で画像を描く
     self.kvImage1 = Image(size_hint=(1.0, 0.7))
     # Layoutを作ってadd_widgetで順次モノを置いていく(並びは置いた順)
     kvLayout1 = BoxLayout(orientation='vertical')
     kvLayout1.add_widget(self.kvImage1)
     # ここだけ2columnでLabelとSliderを並べる
     # Verticalの中に置くhorizontalなBoxLayout
     kvLayout2 = BoxLayout(orientation='horizontal', size_hint=(1.0, 0.1))
     self.kvSlider1Label = Label(text = 'Slider', size_hint=(0.3, 1.0), halign='center')
     kvSlider1 = Slider(size_hint=(0.7, 1.0))
     kvSlider1.bind(value=self.slideCallback)
     kvLayout1.add_widget(kvLayout2)
     kvLayout2.add_widget(self.kvSlider1Label)
     kvLayout2.add_widget(kvSlider1)
     # 1columnに戻る
     kvLayout1.add_widget(kvButton1)
     #カメラ待ち
     while not self._cap.isOpened():
         pass
     # 更新スケジュールとコールバックの指定
     Clock.schedule_interval(self.update, 1.0/30.0)
     return kvLayout1
开发者ID:eiichiromomma,项目名称:CVMLAB,代码行数:28,代码来源:testcam.py

示例3: __init__

 def __init__(self, childHeight, **kwargs):
     super(ListView,self).__init__(**kwargs)
     self.__childHeight = childHeight
     scroll = ScrollViewFixed(bar_width=30,
                         bar_margin=-30,
                         bar_color=[0.8,.8,.8,.99],
                         do_scroll_y = True,
                         do_scroll_x = False,
                         pos_hint= {'x':0,'y':0},
                         size_hint = (None,None),
                         size = self.size)
     box = BoxLayout(orientation='vertical',size_hint=(None,None),
                             size = self.size)
     scroll.add_widget(box)
     super(ListView, self).add_widget(scroll)
     s = Slider(orientation='vertical', value_normalized = 0.5, 
                size_hint =(None,None), padding = 20,
                size = (30, self.size[1]), pos_hint = {'x':1, 'y':0})
     scroll.slider = s
     def scrollMoves(slid,pos):
         scroll.scroll_y = pos
     s.bind(value_normalized=scrollMoves)
     super(ListView, self).add_widget(s, 1)
     self.scroll = scroll
     self.box = box
开发者ID:Sebelino,项目名称:Team18,代码行数:25,代码来源:listview.py

示例4: build

    def build(self):
        root = BoxLayout(orientation='vertical')

        viewer = KinectViewer()
        root.add_widget(viewer)

        toolbar = BoxLayout(size_hint=(1, None), height=50)
        root.add_widget(toolbar)

        slider = Slider(min=1., max=10., value=1.)
        def update_depth_range(instance, value):
            viewer.depth_range = value
        slider.bind(value=update_depth_range)
        toolbar.add_widget(slider)

        button = Button(text='Use RGB shader')
        def use_rgb(*l):
            viewer.canvas.shader.fs = rgb_kinect
        button.bind(on_press=use_rgb)
        toolbar.add_widget(button)

        button = Button(text='Use HSV shader')
        def use_hsv(*l):
            viewer.canvas.shader.fs = hsv_kinect
        button.bind(on_press=use_hsv)
        toolbar.add_widget(button)

        return root
开发者ID:aidanok,项目名称:kivy,代码行数:28,代码来源:kinectviewer.py

示例5: setup_gui

 def setup_gui(self):     
     self.ParentLayout = GridLayout(cols=3, row_force_default=True, row_default_height=200)
     self.label = Label(text='connecting...\n')                
       
      # Additional code to exercise, so you can adapt related code on server for example       
     Matrix_Row_Slider = Slider(min=0, max=8, value=1)
     Matrix_Row_Slider.bind(value=self.onMatrix_Row_Slidervalue)  # handy to know what are the slider's position
     
     Matrix_Col_Slider = Slider(min=0, max=8, value=1)
     Matrix_Col_Slider = Slider(orientation='vertical')        
         
     self.ParentLayout.add_widget(Matrix_Row_Slider)                
     self.Matrix_Layout = GridLayout(cols=8)
     
     # Let's add a spinner to be able to select some colors
     self.Colorspinner = Spinner(text='Green', values=('NA','Green','Red','Orange', 'Cls'), size_hint=(None, None),size=(90, 44), pos_hint={'center_x': .5, 'center_y': .5})
     
     # We define the main buttons matrix here        
     for i in range(64):
         btn = Button(text=str(i), size_hint_x=None,size_hint_y=None, width=20, height=20 )
         btn.bind(on_press=self.callback)
         self.Matrix_Layout.add_widget(btn)       
    
     self.ParentLayout.add_widget(self.Matrix_Layout)        
     self.ParentLayout.add_widget(self.label) 
     self.ParentLayout.add_widget(self.Colorspinner)
     self.ParentLayout.add_widget(Matrix_Col_Slider)
     return self.ParentLayout
开发者ID:dlewin,项目名称:BeagleboneBlack-Server-Book,代码行数:28,代码来源:client2.py

示例6: build

	def build(self):
		# Set up the layout:
		layout = GridLayout(cols=5, spacing=30, padding=30, row_default_height=150)

		# Make the background gray:
		with layout.canvas.before:
			Color(.2,.2,.2,1)
			self.rect = Rectangle(size=(800,600), pos=layout.pos)

		# Instantiate the first UI object (the GPIO input indicator):
		inputDisplay = InputButton(text="Input")

		# Schedule the update of the state of the GPIO input button:
		Clock.schedule_interval(inputDisplay.update, 1.0/10.0)

		# Create the rest of the UI objects (and bind them to callbacks, if necessary):
		outputControl = ToggleButton(text="LED")
		outputControl.bind(on_press=press_callback)
		beepButton = Button(text="BEEP!")
		beepButton.bind(on_press=press_callback)
		wimg = Image(source='logo.png')
		speedSlider = Slider(orientation='vertical', min=1, max=30, value=speed)
		speedSlider.bind(on_touch_down=update_speed, on_touch_move=update_speed)

		# Add the UI elements to the layout:
		layout.add_widget(wimg)
		layout.add_widget(inputDisplay)
		layout.add_widget(outputControl)
		layout.add_widget(beepButton)
		layout.add_widget(speedSlider)

		# Start flashing the LED
		Clock.schedule_once(flash, 1.0/speed)

		return layout
开发者ID:dessant,项目名称:rpi-kivy-screen,代码行数:35,代码来源:main.py

示例7: display_scene

    def display_scene(self, x):
        layout = StackLayout(orientation='tb-lr')
        if (x == 2):
            main = Label(text='WAVE MIXER', size_hint=(1, 0.03),
                         color=(1, 0, 0, 1), background_color=(1, 0, 0, 1))
        else:
            main = Label(text='', size_hint=(1, 0.03),
                         color=(1, 0, 0, 1), background_color=(1, 0, 0, 1))
        label1 = Label(text='File '+str(x), size_hint=(1, 0.1))
        select1 = Button(text='Select file',
                         size_hint=(1, 0.05), background_color=(1, 0, 0, 1))
        select1.bind(on_press=self.selectSound1)
        bt1 = Button(text='Play file', size_hint=(1, 0.05),
                     background_color=(1, 0, 0, 1))
        bt1.bind(on_press=self.callback)
        stop1 = Button(text='Stop Playing', size_hint=(1, 0.05),
                       background_color=(1, 0, 0, 1))
        stop1.bind(on_press=self.stopf1)
        label2 = Label(text='Amplitude', size_hint=(1, 0.1))
        label3 = Label(text='Time Shift', size_hint=(1, 0.1))
        label4 = Label(text='Time Scaling', size_hint=(1, 0.1))
        self.flag1 = 0
        self.flag2 = 0
        self.flag3 = 0
        self.s1 = Slider(min=0.0, max=5.0, value=1.0,
                         size_hint=(0.8, 0.02), background_color=(1, 0, 0, 1))
        self.s2 = Slider(min=-1.0, max=1.0, value=0.5, size_hint=(0.8, 0.02))
        self.s3 = Slider(min=0.0, max=8.0, value=2.0, size_hint=(0.8, 0.02))

        self.c1 = CheckBox(size_hint=(0.8, 0.05))
        self.c2 = CheckBox(size_hint=(0.8, 0.05))
        self.c3 = CheckBox(size_hint=(0.8, 0.05))
        label5 = Label(text='Time Reversal', size_hint=(1, 0.02))
        label6 = Label(text='Select for modulation', size_hint=(1, 0.02))
        label7 = Label(text='Select for mixing', size_hint=(1, 0.02))
        self.c1.bind(active=self.on_checkbox_active1)
        self.c2.bind(active=self.on_checkbox_active2)
        self.c3.bind(active=self.on_checkbox_active3)
        layout.add_widget(main)
        layout.add_widget(label1)
        layout.add_widget(select1)
        layout.add_widget(bt1)
        layout.add_widget(stop1)
        layout.add_widget(label2)
        layout.add_widget(self.s1)
        layout.add_widget(label3)
        layout.add_widget(self.s2)
        layout.add_widget(label4)
        layout.add_widget(self.s3)
        layout.add_widget(self.c1)
        layout.add_widget(label5)
        layout.add_widget(self.c2)
        layout.add_widget(label6)
        layout.add_widget(self.c3)
        layout.add_widget(label7)
        self.s1.bind(value=self.update_value1)
        self.s2.bind(value=self.update_value2)
        self.s3.bind(value=self.update_value3)
        self.lay1.add_widget(layout)
开发者ID:Jigar54,项目名称:WaveMixer,代码行数:59,代码来源:WaveMixer.py

示例8: display_scene2

    def display_scene2(self, x):
        layout2 = StackLayout(orientation='tb-lr')
        if (x == 2):
            main = Label(text='WAVE MIXER',
                         size_hint=(1, 0.03), color=(1, 0, 0, 1))
        else:
            main = Label(text='', size_hint=(1, 0.03),
                         color=(1, 0, 0, 1), background_color=(1, 0, 0, 1))
        label21 = Label(text='File '+str(x), size_hint=(1, 0.1))
        bt21 = Button(text='Play file', size_hint=(1, 0.05),
                      background_color=(1, 0, 0, 1))
        bt21.bind(on_press=self.callback2)
        stop3 = Button(text='Stop Playing', size_hint=(1, 0.05),
                       background_color=(1, 0, 0, 1))
        stop3.bind(on_press=self.stopf3)
        select3 = Button(text='Select file',
                         size_hint=(1, 0.05), background_color=(1, 0, 0, 1))
        select3.bind(on_press=self.selectSound3)
        label22 = Label(text='Amplitude', size_hint=(1, 0.1))
        label23 = Label(text='Time Shift', size_hint=(1, 0.1))
        label24 = Label(text='Time Scaling', size_hint=(1, 0.1))
        self.flag21 = 0
        self.flag22 = 0
        self.flag23 = 0
        self.s21 = Slider(min=0.0, max=5.0, value=1.0,
                          size_hint=(0.8, 0.02), background_color=(1, 0, 0, 1))
        self.s22 = Slider(min=-1.0, max=1.0, value=0.5, size_hint=(0.8, 0.02))
        self.s23 = Slider(min=0.0, max=8.0, value=2.0, size_hint=(0.8, 0.02))

        self.c21 = CheckBox(size_hint=(0.8, 0.05))
        self.c22 = CheckBox(size_hint=(0.8, 0.05))
        self.c23 = CheckBox(size_hint=(0.8, 0.05))
        label25 = Label(text='Time Reversal', size_hint=(1, 0.02))
        label26 = Label(text='Select for modulation', size_hint=(1, 0.02))
        label27 = Label(text='Select for mixing', size_hint=(1, 0.02))
        self.c21.bind(active=self.on_checkbox2_active1)
        self.c22.bind(active=self.on_checkbox2_active2)
        self.c23.bind(active=self.on_checkbox2_active3)
        layout2.add_widget(main)
        layout2.add_widget(label21)
        layout2.add_widget(select3)
        layout2.add_widget(bt21)
        layout2.add_widget(stop3)
        layout2.add_widget(label22)
        layout2.add_widget(self.s21)
        layout2.add_widget(label23)
        layout2.add_widget(self.s22)
        layout2.add_widget(label24)
        layout2.add_widget(self.s23)
        layout2.add_widget(self.c21)
        layout2.add_widget(label25)
        layout2.add_widget(self.c22)
        layout2.add_widget(label26)
        layout2.add_widget(self.c23)
        layout2.add_widget(label27)
        self.s21.bind(value=self.update2_value1)
        self.s22.bind(value=self.update2_value2)
        self.s23.bind(value=self.update2_value3)
        self.lay1.add_widget(layout2)
开发者ID:Jigar54,项目名称:WaveMixer,代码行数:59,代码来源:WaveMixer.py

示例9: on_touch_move

 def on_touch_move(self, touch):
     if touch.grab_current is self:
         self.uMoveType=u'move'
         Slider.on_touch_move(self,touch)
         self.UpdateButtonPos()
         return True
     else:
         return super(cSliderEx, self).on_touch_move(touch)
开发者ID:thica,项目名称:ORCA-Remote,代码行数:8,代码来源:SliderEx.py

示例10: build

    def build(self):
        root = Widget()
        puzzle = Puzzle(resolution=(640, 480), play=True)
        slider = Slider(min=100, max=200, step=10, size=(800, 50))
        slider.bind(value=partial(self.on_value, puzzle))

        root.add_widget(puzzle)
        root.add_widget(slider)
        return root
开发者ID:phvash,项目名称:ICSE_Picture_Puzzle,代码行数:9,代码来源:puzzle.py

示例11: go

 def go(self,screen):
     if screen=="about":
         cnt=BoxLayout(padding=0,spacing=0)
         lbl=Label(text="  [size=20]pyPuzzle Game[/size]\n\nSimple fun memory game\n\n"
                        "Match simple jelly images\n\nEnter your scores.\n\n"
                        "www.yahyakesenek.com @2016",markup=True)
         cnt.add_widget(lbl)
         modal=ModalView(size_hint=(0.7,0.5),background_color=get_color_from_hex("#ff7373"))
         modal.add_widget(cnt)
         modal.open()
         modal.x=self.root.x-modal.width-10
         anim=Animation(center_x=self.root.center_x,center_y=self.root.center_y,d=2,t="out_expo")
         anim.start(modal)
         return
     if screen=="settings":
         cnt=BoxLayout()
         lbl=Label(text="Set Sound Volume :")
         sld=Slider(max=100,min=0,value=25)
         sld.bind(value=self.value_change)
         cnt.add_widget(lbl);cnt.add_widget(sld)
         modal=ModalView(size_hint=(0.8,0.2),background_color=get_color_from_hex("#ff7373"))
         modal.add_widget(cnt)
         modal.open()
         modal.x=self.root.x+modal.width+10
         anim=Animation(center_x=self.root.center_x,center_y=self.root.center_y,d=2,t="out_expo")
         anim.start(modal)
         self.sld=sld
         return
     if screen=="exit":
         cnt=BoxLayout(size_hint=(0.8,0.5),padding=4,spacing=5)
         lbl=Label(text="[size=35][color=#ae5a41]Quit?[/color][/size]",markup=True)
         btnyes=Button(text="Yes")
         btnno=Button(text="No")
         modal=ModalView(size_hint=(0.8,0.2))
         def quit(inst):
             exit()
         def cancel(inst):
             if modal:
                 modal.dismiss()
                 if self.root.current=="game_screen":
                     self.root.current_screen.newGame()
         btnyes.bind(on_release=quit)
         btnno.bind(on_release=cancel)
         cnt.add_widget(lbl)
         cnt.add_widget(btnyes)
         cnt.add_widget(btnno)
         modal.add_widget(cnt)
         modal.open()
         return
     if screen=="end_screen":
         self.level=1
     self.root.current=screen
     if self.root.current=="main_screen":
         if self.snd.state=="stop":
             self.snd.play()
     else:
         self.snd.stop()
开发者ID:yahyakesenek,项目名称:PyPuzzle,代码行数:57,代码来源:main.py

示例12: on_touch_down

 def on_touch_down(self, touch):
     if self.collide_point(*touch.pos):
         self.uMoveType=u'down'
         Slider.on_touch_down(self,touch)
         touch.grab(self)
         self.UpdateButtonPos()
         return True
     else:
         return super(cSliderEx, self).on_touch_down(touch)
开发者ID:thica,项目名称:ORCA-Remote,代码行数:9,代码来源:SliderEx.py

示例13: build

    def build(self):
        self.root = BoxLayout(pos_hint={'center_x':.5, 'center_y':.5}, orientation='vertical')

        self.svg = SvgWidget(size_hint_y=0.9)
        self.root.add_widget(self.svg)
        s = Slider(min=0, max=100, value=0, size_hint_y=0.1)
        self.root.add_widget(s)
        s.bind(value=self.on_value)
        s.value=50
开发者ID:ryandoherty,项目名称:kivysvgtest,代码行数:9,代码来源:main.py

示例14: game_over

    def game_over(self, game_starting=False):

        # calculate score
        score = str(self.score[0]) + '-' + str(self.score[1])
        print "done!", score
        self.save_level()
        content2 = BoxLayout(orientation='vertical', spacing=10)
        # content.add_widget(Label(text='score: %d'%int(score)))
        content = BoxLayout(orientation='vertical', size_hint_y=.7)
        # change show time
        label_slider = LabelTimeSlider(text='Initial Show time: %s s'%self.level)
        content.add_widget(label_slider)
        new_level = Slider(min=1, max=30, value=self.level)
        content.add_widget(new_level)
        new_level.bind(value=label_slider.update)
        new_level.bind(value=self.reset_time)

        # change number of items
        label_nb = LabelNb(text='Number of items: %s'%self.items)
        content.add_widget(label_nb)
        nb_items = Slider(min=5, max=MAX_NBITEMS, value=self.items)
        content.add_widget(nb_items)
        nb_items.bind(value=label_nb.update)
        nb_items.bind(value=self.reset_nb_item)
       
        content2.add_widget(content)
        if game_starting:
            replay_btn = Button(text='Play!')
        else:
            replay_btn = Button(text='Replay!')
        credits_btn = Button(text='Credits')
        action = BoxLayout(orientation='horizontal', size_hint_y=.3)
        action.add_widget(replay_btn)
        action.add_widget(credits_btn)
        content2.add_widget(action)

        if game_starting:
            greeting = "Welcome to Pro Soccer Mem 15. Choose your game mode:"
        elif self.score[0] > self.score[1]:
            greeting = "Congratulations!" + ' Your score was: %s' % str(score)
        elif self.score[1] > self.score[0]:
            greeting = "Oh no! You've been defeated." + ' Your score was: %s' % str(score)
        else:
            greeting = "What a game, it was a tie!" + ' Your score was: %s' % str(score)

        popup = PopupGameOver(title=greeting,
                              content=content2,
                              size_hint=(0.5, 0.5), pos_hint={'x': 0.25, 'y': 0.25},
                              auto_dismiss=False)

        replay_btn.bind(on_press=popup.replay)
        replay_btn.bind(on_press=self.restart_game)
        credits_btn.bind(on_press=popup.credits)
        
        popup.open()
开发者ID:aNxello,项目名称:ProSoccerMem15,代码行数:55,代码来源:main.py

示例15: build

    def build(self):
        root = Widget()
        print(root.height,root.width)
        puzzle = Camera(size=(480, 320), resolution=(480, 320), play=True, allow_stretch=True)
        print("The camera is a {}".format(puzzle))
        slider = Slider(min=100, max=400, step=10, size=(800, 50))
        slider.value=100
        slider.bind(value=partial(self.on_value, puzzle))

        root.add_widget(puzzle)
        root.add_widget(slider)
        return root
开发者ID:TristanTrim,项目名称:magnifyingPhoneApp,代码行数:12,代码来源:main.py


注:本文中的kivy.uix.slider.Slider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。