久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='pktSA'><style id='pktSA'><dir id='pktSA'><q id='pktSA'></q></dir></style></legend>

    <tfoot id='pktSA'></tfoot>

      <bdo id='pktSA'></bdo><ul id='pktSA'></ul>

    <small id='pktSA'></small><noframes id='pktSA'>

        <i id='pktSA'><tr id='pktSA'><dt id='pktSA'><q id='pktSA'><span id='pktSA'><b id='pktSA'><form id='pktSA'><ins id='pktSA'></ins><ul id='pktSA'></ul><sub id='pktSA'></sub></form><legend id='pktSA'></legend><bdo id='pktSA'><pre id='pktSA'><center id='pktSA'></center></pre></bdo></b><th id='pktSA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='pktSA'><tfoot id='pktSA'></tfoot><dl id='pktSA'><fieldset id='pktSA'></fieldset></dl></div>

        Kivy標簽中的文本下劃線?

        Underline text in a Label in Kivy?(Kivy標簽中的文本下劃線?)
          <bdo id='L9Iju'></bdo><ul id='L9Iju'></ul>
          • <legend id='L9Iju'><style id='L9Iju'><dir id='L9Iju'><q id='L9Iju'></q></dir></style></legend>

                  <tbody id='L9Iju'></tbody>
                • <tfoot id='L9Iju'></tfoot>
                  <i id='L9Iju'><tr id='L9Iju'><dt id='L9Iju'><q id='L9Iju'><span id='L9Iju'><b id='L9Iju'><form id='L9Iju'><ins id='L9Iju'></ins><ul id='L9Iju'></ul><sub id='L9Iju'></sub></form><legend id='L9Iju'></legend><bdo id='L9Iju'><pre id='L9Iju'><center id='L9Iju'></center></pre></bdo></b><th id='L9Iju'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='L9Iju'><tfoot id='L9Iju'></tfoot><dl id='L9Iju'><fieldset id='L9Iju'></fieldset></dl></div>

                  <small id='L9Iju'></small><noframes id='L9Iju'>

                • 本文介紹了Kivy標簽中的文本下劃線?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我已閱讀 kivy 中的 標簽文檔.粗體、斜體、字體、大小、顏色等屬性效果很好.

                  I have read the documentation for Labels in kivy. Properties like bold, italic, font, size, color, etc. work pretty well.

                  但是,我怎樣才能使標簽文本加下劃線?

                  However, how can I make the Label text underlined?

                  推薦答案

                  這是一個實現 我在 Google 網上論壇上找到:

                  from kivy.app import App
                  from kivy import kivy_options
                  from extended_markup import LabelXMU
                  
                  kivy_options['text']='pygame'
                  
                  class LabelWithMarkup(App):
                      def build(self):
                          root = LabelXMU(text=r"Some [b]bold[/b] [i]italic[/i] [u] underlined[/u] [s] strikethrough[/s] and plain text",   font_size=22)
                          return root
                  
                  if __name__ == '__main__':
                      LabelWithMarkup().run()
                  

                  extended.py:

                  from kivy.uix.label import Label
                  from kivy.core.text.markup import MarkupLabel
                  
                  try:
                      import pygame
                  except:
                      raise
                  #
                  #pygame_cache = {}
                  #pygame_cache_order = []
                  #
                  #pygame.font.init()
                  
                  
                  class CoreLabelXMU(MarkupLabel):
                      ''' A  core label with extended markup capabilities (underline and strikethrough markups)
                      Brendan Scott 6 March 2013
                      '''
                      def __init__(self, *largs, **kwargs):
                          self._style_stack = {}
                          self._refs = {}
                          super(MarkupLabel, self).__init__(*largs, **kwargs)    
                          self.options['underline'] = False
                          self.options['strike'] = False
                  
                  
                      def _pre_render(self):
                          # split markup, words, and lines
                          # result: list of word with position and width/height
                          # during the first pass, we don't care about h/valign
                          self._lines = lines = []
                          self._refs = {}
                          self._anchors = {}
                          spush = self._push_style
                          spop = self._pop_style
                          options = self.options
                          options['_ref'] = None
                  
                          for item in self.markup:
                              if item == '[b]':
                                  spush('bold')
                                  options['bold'] = True
                                  self.resolve_font_name()
                              elif item == '[/b]':
                                  spop('bold')
                                  self.resolve_font_name()
                              elif item == '[i]':
                                  spush('italic')
                                  options['italic'] = True
                                  self.resolve_font_name()
                              elif item == '[/i]':
                                  spop('italic')
                                  self.resolve_font_name()
                              elif item =='[s]':
                                  spush('strike')
                                  options['strike']=True  
                              elif item =='[/s]':
                                  spop('strike')
                              elif item =='[u]':
                                  spush('underline')
                                  options['underline']=True  
                              elif item =='[/u]':
                                  spop('underline')
                  
                              elif item[:6] == '[size=':
                                  item = item[6:-1]
                                  try:
                                      if item[-2:] in ('px', 'pt', 'in', 'cm', 'mm', 'dp', 'sp'):
                                          size = dpi2px(item[:-2], item[-2:])
                                      else:
                                          size = int(item)
                                  except ValueError:
                                      raise
                                      size = options['font_size']
                                  spush('font_size')
                                  options['font_size'] = size
                              elif item == '[/size]':
                                  spop('font_size')
                              elif item[:7] == '[color=':
                                  color = parse_color(item[7:-1])
                                  spush('color')
                                  options['color'] = color
                              elif item == '[/color]':
                                  spop('color')
                              elif item[:6] == '[font=':
                                  fontname = item[6:-1]
                                  spush('font_name')
                                  options['font_name'] = fontname
                                  self.resolve_font_name()
                              elif item == '[/font]':
                                  spop('font_name')
                                  self.resolve_font_name()
                              elif item[:5] == '[ref=':
                                  ref = item[5:-1]
                                  spush('_ref')
                                  options['_ref'] = ref
                              elif item == '[/ref]':
                                  spop('_ref')
                              elif item[:8] == '[anchor=':
                                  ref = item[8:-1]
                                  if len(lines):
                                      x, y = lines[-1][0:2]
                                  else:
                                      x = y = 0
                                  self._anchors[ref] = x, y
                              else:
                                  item = item.replace('&bl;', '[').replace(
                                          '&br;', ']').replace('&amp;', '&')
                                  self._pre_render_label(item, options, lines)
                  
                          # calculate the texture size
                          w, h = self.text_size
                          if h < 0:
                              h = None
                          if w < 0:
                              w = None
                          if w is None:
                              w = max([line[0] for line in lines])
                          if h is None:
                              h = sum([line[1] for line in lines])
                          return w, h
                  
                  
                  
                      def _render_text(self, text, x, y):
                          font = self._get_font()
                          if self.options['underline']:
                              font.set_underline(True)
                          else:
                              font.set_underline(False)
                  
                          color = [c * 255 for c in self.options['color']]
                          color[0], color[2] = color[2], color[0]
                          try:
                              text = font.render(text, True, color)
                              if self.options['strike']:
                                  ''' draw a horizontal line through the vertical middle of this surface in the foreground colour'''
                                  r = text.get_rect()
                                  pygame.draw.line(text, color, r.midleft, r.midright )
                  
                              self._pygame_surface.blit(text, (x, y), None, pygame.BLEND_RGBA_ADD)
                          except pygame.error:
                              pass
                  
                  
                  
                  class LabelXMU(Label):
                      ''' A label with extended markup capabilities (underline and strikethrough markups)
                      Brendan Scott 6 March 2013
                      '''
                  
                      def __init__(self, **kwargs):
                          kwargs['markup']=True
                          super(LabelXMU, self).__init__(**kwargs)
                          d = Label._font_properties
                          dkw = dict(zip(d, [getattr(self, x) for x in d]))
                          self._label = CoreLabelXMU(**dkw)
                  

                  這篇關于Kivy標簽中的文本下劃線?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                  Discord bot isn#39;t responding to commands(Discord 機器人沒有響應命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關于我嗎?Discord 機器人的功能?(不和諧.py))
                  message.channel.id Discord PY(message.channel.id Discord PY)
                  How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                  discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)

                      <tbody id='qsOqC'></tbody>
                    • <bdo id='qsOqC'></bdo><ul id='qsOqC'></ul>
                    • <tfoot id='qsOqC'></tfoot>

                      <i id='qsOqC'><tr id='qsOqC'><dt id='qsOqC'><q id='qsOqC'><span id='qsOqC'><b id='qsOqC'><form id='qsOqC'><ins id='qsOqC'></ins><ul id='qsOqC'></ul><sub id='qsOqC'></sub></form><legend id='qsOqC'></legend><bdo id='qsOqC'><pre id='qsOqC'><center id='qsOqC'></center></pre></bdo></b><th id='qsOqC'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='qsOqC'><tfoot id='qsOqC'></tfoot><dl id='qsOqC'><fieldset id='qsOqC'></fieldset></dl></div>

                          <small id='qsOqC'></small><noframes id='qsOqC'>

                            <legend id='qsOqC'><style id='qsOqC'><dir id='qsOqC'><q id='qsOqC'></q></dir></style></legend>

                            主站蜘蛛池模板: 久久精品国产99国产精品 | 91精品国产综合久久久动漫日韩 | 欧美色综合一区二区三区 | 精品视频免费 | 国产有码| 天天玩天天干天天操 | 日日夜夜免费精品视频 | www.久久精品视频 | 波多野结衣一区二区三区在线观看 | 91原创视频 | 91精品国产一区二区三区 | 99久久精品免费看国产四区 | 精品国产乱码久久久久久蜜柚 | av中文字幕在线播放 | 久久1区 | 一区二区三区在线播放 | 99免费看 | 欧美亚洲国语精品一区二区 | 毛片一级黄色 | 日韩欧美三区 | 日韩欧美国产一区二区三区 | 国产精品18hdxxxⅹ在线 | 色又黄又爽网站www久久 | 日韩精品一区在线 | 久久69精品久久久久久久电影好 | 九九视频在线观看视频6 | 久久久成人精品 | 高清人人天天夜夜曰狠狠狠狠 | 久久国产精品无码网站 | 操久久| 91电影| 国产在线观看一区二区三区 | 美女爽到呻吟久久久久 | 成人一区二区三区在线观看 | 日韩中文字幕在线视频观看 | 国产aⅴ精品 | 一级毛片成人免费看a | 中文字幕日本一区二区 | 黄色一级大片在线免费看产 | 久久久久久国产精品免费免费狐狸 | 中文在线视频观看 |