1. <tfoot id='UROHv'></tfoot>

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

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

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

        KivyMD 如何更改 MDToolbar 标题大小和字体?

        时间:2023-10-09
      1. <tfoot id='MX3Bg'></tfoot>

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

        <legend id='MX3Bg'><style id='MX3Bg'><dir id='MX3Bg'><q id='MX3Bg'></q></dir></style></legend>
            <bdo id='MX3Bg'></bdo><ul id='MX3Bg'></ul>

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

                  <tbody id='MX3Bg'></tbody>

                  本文介绍了KivyMD 如何更改 MDToolbar 标题大小和字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试学习 KivyMD 工具.所以我创建了 MDToolBar,它的标题在单击一些按钮后发生了变化.我试图优化它的 text_size 但做不到.我已经尝试过 font_type:'H1'font_size:'8sp'.如果可能的话,我也想改变它的字体.任何人都可以帮我解决这个问题.我在下面分享最少的代码:

                  Im trying to learn KivyMD tools. So i created MDToolBar and it's title changes after some button clicks. Im trying to optimize it's text_size but can't do it.I already tried font_type:'H1', font_size: '8sp'. Also i want to change it's font if its possible. Can anyone help me about that. Im sharing minimal code below:

                  from kivy.lang import Builder
                  from kivy.uix.screenmanager import Screen,ScreenManager
                  kv = Builder.load_string("""
                  <SM>:
                      P1:
                  <P1>:
                      BoxLayout:
                          orientation: 'vertical'
                          MDToolbar:
                              title: 'TEST'
                              font_size: '50sp'
                              font_name: 'font1.ttf'
                  """)
                  class P1(Screen):
                      pass
                  class SM(ScreenManager):
                      pass
                  class MyApp(MDApp):
                      def build(self):
                          return SM()
                  if __name__ == '__main__':
                      MyApp().run()
                  
                  

                  推荐答案

                  from kivy.clock import Clock
                  from kivy.lang import Builder
                  from kivy.uix.screenmanager import Screen, ScreenManager
                  
                  from kivymd.app import MDApp
                  
                  kv = Builder.load_string(
                      """
                  <SM>
                      P1:
                  
                  
                  <P1>
                  
                      BoxLayout:
                          orientation: 'vertical'
                  
                          MDToolbar:
                              id: toolbar
                              title: 'TEST'
                  """)
                  
                  
                  class P1(Screen):
                      def __init__(self, **kw):
                          super().__init__(**kw)
                          Clock.schedule_once(self.set_toolbar_font_name)
                          Clock.schedule_once(self.set_toolbar_font_size)
                  
                      def set_toolbar_font_name(self, *args):
                          self.ids.toolbar.ids.label_title.font_name = "JetBrainsMono-ExtraBold-Italic.ttf"
                  
                      def set_toolbar_font_size(self, *args):
                          self.ids.toolbar.ids.label_title.font_size = '50sp'
                  
                  
                  class SM(ScreenManager):
                      pass
                  
                  
                  class MyApp(MDApp):
                      def build(self):
                          return SM()
                  
                  
                  if __name__ == '__main__':
                      MyApp().run()
                  

                  这篇关于KivyMD 如何更改 MDToolbar 标题大小和字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Kivy 在移动时获取小部件在 Scatter 中的位置 下一篇:我如何在我的 kivy 程序中使用 json api

                  相关文章

                  最新文章

                • <legend id='3EEE8'><style id='3EEE8'><dir id='3EEE8'><q id='3EEE8'></q></dir></style></legend>

                  <small id='3EEE8'></small><noframes id='3EEE8'>

                    <tfoot id='3EEE8'></tfoot>
                      • <bdo id='3EEE8'></bdo><ul id='3EEE8'></ul>

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