KV语言中的Python阿拉伯语文本

时间:2019-01-15 12:45:03

标签: python python-3.x kivy

我已经尝试了字体内容的定位,如下所示:

   Label:
        font_name: 'Titr.ttf'


        font_size: 34


        text: "پاسمار"

我使用b titr,我将b titr重命名为titr,它确实找到了它,因为ttf在同一文件夹中,我可以看到不同之处,当没有font_name:'Titr.ttf'时,它给出一堆随机的东西,但是当有十分之一时,它只有垂直的矩形。

    #! /usr/local/bin/python  -*- coding: UTF-8 -*-

from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen, NoTransition
from kivy.properties import ObjectProperty
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.uix.tabbedpanel import TabbedPanelHeader
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.gridlayout import GridLayout
from functools import partial
from kivy.base import runTouchApp
from kivy.uix.image import Image
from kivy.uix.widget import Widget
from kivy.uix.popup import Popup
import sys
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.image import Image
from kivy.uix.behaviors import ButtonBehavior 
from kivy.lang import Builder
from kivy.base import runTouchApp
import random
import time
# -*- coding: utf-8 -*-

from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen, NoTransition
from kivy.properties import ObjectProperty, NumericProperty

import time
import threading



class ScreensApp(App):  
    def build(self):  
        return RootWidget()


class ScreenOne(Screen):
    pass


class ScreenTwo(Screen):

    def __init__(self, **kwargs):
        super(ScreenTwo, self).__init__(**kwargs)


class RootWidget(FloatLayout):
    pass

class ImageButton(ButtonBehavior, Image):  
    def on_press(self):
        print ('pressed')

    def displayScreenThenLeave(self):
        self.changeScreen()

    def changeScreen(self):
        if self.manager.current == 'screen1':
            self.manager.current = 'screen2'
        else:
            self.manager.current = 'screen1'


class Manager(ScreenManager):

    screen_one = ObjectProperty(None)
    screen_two = ObjectProperty(None)


class ScreensApp(App):

    def build(self):
        m = Manager(transition=NoTransition())
        return m

if __name__ == "__main__":
    ScreensApp().run()
class The_AssignmentApp(App):  
    def build(self):  
        return RootWidget()
if __name__ == "__main__":
    The_AssignmentApp().run()









#:kivy 1.10.1

--编码:utf-8--

<ScreenOne>:

    BoxLayout:
        orientation: "vertical"
        size: root.size
        spacing: 15                
        padding: 200


    Label:
        font_name: 'Titr.ttf'
        font_size: 34
        text: "پاسمار"
    Button:
        background_color: 0, 255, 0, .255
        text: "Start Pasmar"
        on_release: root.manager.current = "screen2"

<ScreenTwo>:

    BoxLayout:

    orientation: "vertical"
    size: root.size
    spacing: 20
    padding: 20
    ImageButton:
        Image:
            source:'Card_club.png'  
            size_hint: .2, .2


<Manager>:
    id: screen_manager

    screen_one: screen_one
    screen_two: screen_two

    ScreenOne:
        id: screen_one
        name: "screen1"
        manager: screen_manager

    ScreenTwo:
        id: screen_two
        name: "screen2"
        manager: screen_manager

0 个答案:

没有答案