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


Python Clipboard.get方法代码示例

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


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

示例1: build

# 需要导入模块: from kivy.core.clipboard import Clipboard [as 别名]
# 或者: from kivy.core.clipboard.Clipboard import get [as 别名]
 def build(self):
     root= GridLayout()
     layout = FloatLayout(orientation='horizontal', size=(450,300), size_hint=(None, None))
     #call function when text changes inside TextInput
     textinput.bind(text=on_text)
     print ('value is ', textinput.text)
     print Clipboard.put(textinput.text,'UTF8_STRING')
     print Clipboard.get('UTF8_STRING')
     #Use copied clipboard value as text for Button
     button.text= Clipboard.get('UTF8_STRING')
     layout.add_widget(button)
     layout.add_widget(textinput)
     root.add_widget(layout)
     return root
开发者ID:karanbalkar,项目名称:KivyClipBoardTextInputDemo,代码行数:16,代码来源:clipboard.py

示例2: on_paste_point

# 需要导入模块: from kivy.core.clipboard import Clipboard [as 别名]
# 或者: from kivy.core.clipboard.Clipboard import get [as 别名]
 def on_paste_point(self, *args):
     try:
         point_string = Clipboard.get('UTF8_STRING')
         lat_lon = point_string.split(",")
         lat = float(lat_lon[0])
         lon = float(lat_lon[1])
         self.ids.lat.text = str(lat)
         self.ids.lon.text = str(lon)
     except Exception:
         toast('Required format is: Latitude, Longitude\nin NN.NNNNN decimal format', True)
开发者ID:imstimpy,项目名称:RaceCapture_App,代码行数:12,代码来源:trackconfigview.py

示例3: on_paste_point

# 需要导入模块: from kivy.core.clipboard import Clipboard [as 别名]
# 或者: from kivy.core.clipboard.Clipboard import get [as 别名]
 def on_paste_point(self, *args):
     try:
         point_string = Clipboard.get('UTF8_STRING')
         lat_lon = point_string.split(",")
         lat = float(lat_lon[0])
         lon = float(lat_lon[1])
         self.ids.lat.text = str(lat)
         self.ids.lon.text = str(lon)
     except ValueError as e:
         Logger.error("GeoPointEditor: error handling paste: {}".format(e))
         toast('Required format is: Latitude, Longitude\nin NN.NNNNN decimal format', True)
开发者ID:autosportlabs,项目名称:RaceCapture_App,代码行数:13,代码来源:trackconfigview.py

示例4: do

# 需要导入模块: from kivy.core.clipboard import Clipboard [as 别名]
# 或者: from kivy.core.clipboard.Clipboard import get [as 别名]
    def do(self, action):
        textinput = self.textinput

        global Clipboard
        if Clipboard is None:
            from kivy.core.clipboard import Clipboard

        if action == 'cut':
            Clipboard.put(textinput.selection_text, 'text/plain')
            textinput.delete_selection()
        elif action == 'copy':
            Clipboard.put(textinput.selection_text, 'text/plain')
        elif action == 'paste':
            data = Clipboard.get('text/plain')
            if data:
                textinput.delete_selection()
                textinput.insert_text(data)
开发者ID:phlax,项目名称:kivy,代码行数:19,代码来源:textinput.py

示例5: _window_on_key_down

# 需要导入模块: from kivy.core.clipboard import Clipboard [as 别名]
# 或者: from kivy.core.clipboard.Clipboard import get [as 别名]
    def _window_on_key_down(self, window, key, scancode=None, unicode=None,
                            modifiers=None):
        global Clipboard
        if Clipboard is None:
            from kivy.core.clipboard import Clipboard

        is_osx = sys.platform == 'darwin'
        # Keycodes on OSX:
        ctrl, cmd = 64, 1024

        if unicode and not key in (self.interesting_keys.keys() + [27]):
            # This allows *either* ctrl *or* cmd, but not both.
            if modifiers == ['ctrl'] or (is_osx and modifiers == ['meta']):
                if key == ord('x'): # cut selection
                    Clipboard.put(self.selection_text, 'text/plain')
                    self.delete_selection()
                elif key == ord('c'): # copy selection
                    Clipboard.put(self.selection_text, 'text/plain')
                elif key == ord('v'): # paste selection
                    data = Clipboard.get('text/plain')
                    if data:
                        self.delete_selection()
                        self.insert_text(data)
                elif key == ord('a'): # select all
                    self.selection_from = 0
                    self.selection_to = len(self.text)
                    self._update_selection(True)
            else:
                if self._selection:
                    self.delete_selection()
                self.insert_text(unicode)
            #self._recalc_size()
            return

        if key == 27: # escape
            self.focus = False
            return True
        elif key == 9: # tab
            self.insert_text('\t')
            return True

        k = self.interesting_keys.get(key)
        if k:
            key = (None, None, k, 1)
            self._key_down(key)
开发者ID:jon1012,项目名称:kivy,代码行数:47,代码来源:textinput.py

示例6: _keyboard_on_key_down

# 需要导入模块: from kivy.core.clipboard import Clipboard [as 别名]
# 或者: from kivy.core.clipboard.Clipboard import get [as 别名]
    def _keyboard_on_key_down(self, window, keycode, text, modifiers):
        global Clipboard
        if Clipboard is None:
            from kivy.core.clipboard import Clipboard

        is_osx = sys.platform == "darwin"
        # Keycodes on OSX:
        ctrl, cmd = 64, 1024
        key, key_str = keycode

        if text and not key in (self.interesting_keys.keys() + [27]):
            # This allows *either* ctrl *or* cmd, but not both.
            if modifiers == ["ctrl"] or (is_osx and modifiers == ["meta"]):
                if key == ord("x"):  # cut selection
                    Clipboard.put(self.selection_text, "text/plain")
                    self.delete_selection()
                elif key == ord("c"):  # copy selection
                    Clipboard.put(self.selection_text, "text/plain")
                elif key == ord("v"):  # paste selection
                    data = Clipboard.get("text/plain")
                    if data:
                        self.delete_selection()
                        self.insert_text(data)
                elif key == ord("a"):  # select all
                    self.selection_from = 0
                    self.selection_to = len(self.text)
                    self._update_selection(True)
            else:
                if self._selection:
                    self.delete_selection()
                self.insert_text(text)
            # self._recalc_size()
            return

        if key == 27:  # escape
            self.focus = False
            return True
        elif key == 9:  # tab
            self.insert_text("\t")
            return True

        k = self.interesting_keys.get(key)
        if k:
            key = (None, None, k, 1)
            self._key_down(key)
开发者ID:fivejjs,项目名称:kivy,代码行数:47,代码来源:textinput.py

示例7: on_edit_button

# 需要导入模块: from kivy.core.clipboard import Clipboard [as 别名]
# 或者: from kivy.core.clipboard.Clipboard import get [as 别名]
 def on_edit_button(self, instance):
     listOptions = list()
     
     bSelection = (self.m_oEditorInput.selection_text != "")
     if bSelection:
         listOptions.append(("Cut", self.on_cut_button))
         listOptions.append(("Copy", self.on_copy_button))
     
     clipboardcontents = None
     try:
         clipboardcontents = Clipboard.get('UTF8_STRING')
     except:
         pass
     if clipboardcontents and len(clipboardcontents) > 0:
         listOptions.append(("Paste", self.on_paste_button))
     
     if bSelection:
         listOptions.append(("", None))
         listOptions.append(("Indent", self.on_indent_button))
         listOptions.append(("Unindent", self.on_unindent_button))
     
     if len(listOptions) > 0:
         self.chooseoptionpopup = ChooseOptionPopup("Edit", listOptions)
开发者ID:tazjel,项目名称:Pyco,代码行数:25,代码来源:editorwidget.py

示例8: on_paste_button

# 需要导入模块: from kivy.core.clipboard import Clipboard [as 别名]
# 或者: from kivy.core.clipboard.Clipboard import get [as 别名]
 def on_paste_button(self):
     clipboardcontents = Clipboard.get('UTF8_STRING')
     if clipboardcontents and len(clipboardcontents) > 0:
         self.m_oEditorInput.insert_text(clipboardcontents)
开发者ID:tazjel,项目名称:Pyco,代码行数:6,代码来源:editorwidget.py

示例9: copy_address_to_clipboard

# 需要导入模块: from kivy.core.clipboard import Clipboard [as 别名]
# 或者: from kivy.core.clipboard.Clipboard import get [as 别名]
 def copy_address_to_clipboard(self, instance):
     address = instance.next_address
     clipboard.copy(address)
     self.show_copied_popup(address)
     print Clipboard.get('UTF8_STRING')
开发者ID:Belxjander,项目名称:Kirito,代码行数:7,代码来源:main.py

示例10: on_text

# 需要导入模块: from kivy.core.clipboard import Clipboard [as 别名]
# 或者: from kivy.core.clipboard.Clipboard import get [as 别名]
def on_text(self, *args):
        print ('new value is ', textinput.text)
        Clipboard.put(textinput.text,'UTF8_STRING')
        button.text= Clipboard.get('UTF8_STRING')
        self.add_widget(button)
开发者ID:karanbalkar,项目名称:KivyClipBoardTextInputDemo,代码行数:7,代码来源:clipboard.py

示例11: on_touch_up

# 需要导入模块: from kivy.core.clipboard import Clipboard [as 别名]
# 或者: from kivy.core.clipboard.Clipboard import get [as 别名]
 def on_touch_up(self, touch):
     if touch.ud is None:
         return
     x, y = self.to_local(*touch.pos)
     if 'key' in touch.ud and touch.ud['key'] == self.get_key_at_pos(x, y) and self.get_key_at_pos(x, y) is not None:
         displayed_char, internal, special_char, size = touch.ud['key'][0]
         b_keycode = special_char
         b_modifiers = self._get_modifiers()
         if special_char.startswith('sug'):
             if internal is not None and internal != '':
                 word = self.get_current_word()
                 textarea = self.get_text_area()
                 textarea.select_text(textarea.cursor_index() - len(word), textarea.cursor_index())
                 textarea.delete_selection()
         if internal is not None and len(internal) == 1 and not (len(special_char) == 1 and special_char.isalpha()):
             prev_word = str(self.get_previous_word())
             cur_word = str(self.get_current_word())
             if cur_word != '':
                 self.user_nograms += 1
                 if cur_word not in self.words:
                     self.words[cur_word.lower()] = self.val_dist(tuple(map(self.key_centers.__getitem__, cur_word.lower()))) + (0.0,)
                 self.user_unigrams[cur_word] = self.user_unigrams.get(cur_word, 0) + 1
                 if prev_word != '':
                     self.user_bigrams[(prev_word, cur_word)] = self.user_bigrams.get((prev_word, cur_word), 0) + 1
                 self.dispatch('on_key_down', b_keycode, internal, b_modifiers)
                 matches = self.candidate_guesses()[:6]
                 self.update_candidates(matches)
             else:
                 self.dispatch('on_key_down', b_keycode, internal, b_modifiers)
         else:
             self.dispatch('on_key_down', b_keycode, internal, b_modifiers)
         if (len(special_char) == 1 and special_char.isalpha()) or special_char == 'backspace':
             word = self.get_current_word()
             if len(word) >= 4:
                 matches = self.candidate_predictions(word)[:6]
             else:
                 matches = []
             self.update_candidates(matches)
     elif 'ctrl' in touch.ud and self.get_key_at_pos(x, y) is not None:
         displayed_char, internal, special_char, size = self.get_key_at_pos(x, y)[0]
         k = special_char
         if k == 'c':
             textarea = self.get_text_area()
             Clipboard.put(textarea.selection_text, 'STRING')
             textarea.cancel_selection()
         elif k == 'v':
             textarea = self.get_text_area()
             textarea.delete_selection()
             textarea.insert_text(Clipboard.get('STRING'))
         elif k == 'a':
             textarea = self.get_text_area()
             textarea.select_all()
         elif k == 'x':
             textarea = self.get_text_area()
             Clipboard.put(textarea.selection_text, 'STRING')
             textarea.delete_selection()
         elif k == 'z':
             textarea = self.get_text_area()
             textarea.do_undo()
         elif k == 'y':
             textarea = self.get_text_area()
             textarea.do_redo()
         elif k == 'l':
             available_layouts = self.available_layouts.keys()
             self.layout = available_layouts[(available_layouts.index(self.layout) + 1) % len(self.available_layouts)]
             self.reload_layout()
         #elif k == 's':
         #    window = self.get_parent_window()
         #    textarea = self.get_text_area()
         #    def _on_close(self):
         #        window.children[0].remove_widget(settings)
         #        textarea.focus = True
         #    settings = Settings(on_close=_on_close)
         #    settings.add_json_panel('VKeyboard Settings', self.config, 'settings.json')
         #    window.children[1].add_widget(settings)
         #    window.release_keyboard(self)
             
     elif 'line' in touch.ud:
         gesture = touch.ud['line'].points
         gesture = [(gesture[i], gesture[i+1]) for i in xrange(0, len(gesture), 2)]
         matches = self.candidate_matches(gesture)[:6]
         self.update_candidates(matches)
         b_modifiers = self._get_modifiers()
         if 'shift' in b_modifiers and 'capslock' not in b_modifiers:
             matches = [(w[0].upper() + w[1:], p) for w, p in matches]
         elif 'capslock' in b_modifiers and 'shift' not in b_modifiers:
             matches = [(w.upper(), p) for w, p in matches]
         if len(matches) > 0:
             textarea = self.get_text_area()
             textarea.delete_selection()
             textarea.insert_text(matches[0][0])
     if touch.grab_current is self:
         self.process_key_up(touch)
     if 'line' in touch.ud:
         self.canvas.remove(touch.ud['line'])
     return super(VKeyboard, self).on_touch_up(touch)
开发者ID:gerardlouw,项目名称:GestureKeyboard,代码行数:98,代码来源:vkeyboard.py

示例12: copy_to_clipboard

# 需要导入模块: from kivy.core.clipboard import Clipboard [as 别名]
# 或者: from kivy.core.clipboard.Clipboard import get [as 别名]
 def copy_to_clipboard(self, text):
     Clipboard.put(bytes(text, 'UTF-8'), 'UTF8_STRING')
     Clipboard.get('UTF8_STRING')
开发者ID:Ankoa,项目名称:Ankoa-GUI,代码行数:5,代码来源:main.py


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