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


Python Gtk.STOCK_MEDIA_PLAY属性代码示例

本文整理汇总了Python中gi.repository.Gtk.STOCK_MEDIA_PLAY属性的典型用法代码示例。如果您正苦于以下问题:Python Gtk.STOCK_MEDIA_PLAY属性的具体用法?Python Gtk.STOCK_MEDIA_PLAY怎么用?Python Gtk.STOCK_MEDIA_PLAY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在gi.repository.Gtk的用法示例。


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

示例1: on_playpause_togglebutton_toggled

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_MEDIA_PLAY [as 别名]
def on_playpause_togglebutton_toggled(self, widget):
        if ply.playpause_button.get_active():
            img = Gtk.Image.new_from_stock(Gtk.STOCK_MEDIA_PLAY, Gtk.IconSize.BUTTON)
            widget.set_property("image", img)
            ply.pause()
        else:
            img = Gtk.Image.new_from_stock(Gtk.STOCK_MEDIA_PAUSE, Gtk.IconSize.BUTTON)
            widget.set_property("image", img)
            ply.play() 
开发者ID:encarsia,项目名称:gpt,代码行数:11,代码来源:modules.py

示例2: update_media_button_states

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_MEDIA_PLAY [as 别名]
def update_media_button_states(self):
    mc = self.cast.media_controller if self.cast else None
    self.play_button.set_sensitive(bool(self.transcoder and self.cast and mc.status.player_state in ('BUFFERING','PLAYING','PAUSED','IDLE','UNKNOWN') and self.fn))
    self.volume_button.set_sensitive(bool(self.cast))
    self.stop_button.set_sensitive(bool(self.transcoder and self.cast and mc.status.player_state in ('BUFFERING','PLAYING','PAUSED')))
    self.rewind_button.set_sensitive(bool(self.transcoder and self.cast and mc.status.player_state in ('BUFFERING','PLAYING','PAUSED')))
    self.forward_button.set_sensitive(bool(self.transcoder and self.cast and mc.status.player_state in ('BUFFERING','PLAYING','PAUSED')))
    self.play_button.set_image(Gtk.Image(stock=Gtk.STOCK_MEDIA_PAUSE) if self.cast and mc.status.player_state=='PLAYING' else Gtk.Image(stock=Gtk.STOCK_MEDIA_PLAY))
    if self.transcoder and self.duration:
      self.scrubber_adj.set_upper(self.duration)
      self.scrubber.set_sensitive(True)
    else:
      self.scrubber.set_sensitive(False)
    self.update_button_visible() 
开发者ID:keredson,项目名称:gnomecast,代码行数:16,代码来源:gnomecast.py

示例3: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_MEDIA_PLAY [as 别名]
def __init__(self):
    
        #constructing the window and setting up its size, and the destroy signal
        super(SeekingExample, self).__init__()
        self.set_size_request(600, 50)
        self.set_title("Simple audio player")
        self.connect("destroy", self.on_destroy)
        
        Gst.init()
        
        #setting up the playbin elements
        self.playbin = Gst.ElementFactory.make("playbin", "playbin")
        self.playbin.set_property("uri", "file:///tmp/lea.mp3")
        
        #setting up a simple Horizontal box layout, with a window size of 500
        self.box = Gtk.Box(orientation = Gtk.Orientation.HORIZONTAL)
        self.add(self.box)
        
        #setting up controls with their signals and callbacks
        self.play_button = Gtk.Button.new_from_stock(Gtk.STOCK_MEDIA_PLAY)
        self.play_button.connect("clicked", self.on_play)
        self.pause_button = Gtk.Button.new_from_stock(Gtk.STOCK_MEDIA_PAUSE)
        self.pause_button.connect("clicked", self.on_pause)
        
        #creating a slider and calculating its range      
        self.slider = Gtk.Scale.new_with_range(Gtk.Orientation.HORIZONTAL, 0, 100, 0.5)
        self.slider_handler_id = self.slider.connect("value-changed", self.on_slider_seek)
        
        #adding the controls to the layout
        self.box.pack_start(self.play_button, False, False, 2)
        self.box.pack_start(self.pause_button, False, False, 2)
        self.box.pack_start(self.slider, True, True, 2)
        
        
        #showing the GUI elements 
        self.show_all() 
开发者ID:hadware,项目名称:gstreamer-python-player,代码行数:38,代码来源:seek.py

示例4: on_tray_popup_menu

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_MEDIA_PLAY [as 别名]
def on_tray_popup_menu(self, _status_icon, button, activate_time):
        """
        Called when the user right-clicks the tray icon
        """

        tray_menu_xml = """
        <ui>
        <popup action="TrayMenu">
            <menuitem action="Show"/>
            <menuitem action="Quit"/>
        </popup>
        </ui>"""

        # Create an ActionGroup
        actiongroup = Gtk.ActionGroup("TrayActionGroup")

        # Create actions
        actiongroup.add_actions(
            [
                (
                    "Show",
                    Gtk.STOCK_MEDIA_PLAY,
                    _("Show RedNotebook"),
                    None,
                    None,
                    lambda widget: self.show(),
                ),
                ("Quit", Gtk.STOCK_QUIT, None, None, None, self.on_quit_activate),
            ]
        )

        # Add the actiongroup to the uimanager
        self.uimanager.insert_action_group(actiongroup, 0)

        # Add a UI description
        self.uimanager.add_ui_from_string(tray_menu_xml)

        # Create a Menu
        menu = self.uimanager.get_widget("/TrayMenu")

        menu.popup(None, None, None, None, button, activate_time) 
开发者ID:jendrikseipp,项目名称:rednotebook,代码行数:43,代码来源:main_window.py


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