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

    <tfoot id='bJSDl'></tfoot>

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

    1. <small id='bJSDl'></small><noframes id='bJSDl'>

    2. <i id='bJSDl'><tr id='bJSDl'><dt id='bJSDl'><q id='bJSDl'><span id='bJSDl'><b id='bJSDl'><form id='bJSDl'><ins id='bJSDl'></ins><ul id='bJSDl'></ul><sub id='bJSDl'></sub></form><legend id='bJSDl'></legend><bdo id='bJSDl'><pre id='bJSDl'><center id='bJSDl'></center></pre></bdo></b><th id='bJSDl'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='bJSDl'><tfoot id='bJSDl'></tfoot><dl id='bJSDl'><fieldset id='bJSDl'></fieldset></dl></div>
    3. Kivy:如何使小部件表現得像溢出:隱藏

      Kivy: How to make widget behave like overflow:hidden(Kivy:如何使小部件表現得像溢出:隱藏)
    4. <legend id='XdrNp'><style id='XdrNp'><dir id='XdrNp'><q id='XdrNp'></q></dir></style></legend>

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

            <bdo id='XdrNp'></bdo><ul id='XdrNp'></ul>
                <tfoot id='XdrNp'></tfoot>

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

                本文介紹了Kivy:如何使小部件表現得像溢出:隱藏的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我想在 Kivy 中創建帶有許多矩形按鈕的 GridLayout,其中包含一些不同大小的自定義圖像.為此,我想縮放圖像(我想這樣做的方式如下所示),然后裁剪/隱藏溢出小部件邊框的部分.調整大小效果很好,但我不知道如何隱藏/裁剪矩形之外的部分.例如:如果小部件的尺寸為 10 像素 x 10 像素,而我的圖像為 100 像素 x 200 像素,我會將其調整為 10 像素 x 20 像素并在小部件中居中,但下方和上方的 5 像素將可見.我不要那個.:) 云有人幫我解決這個問題嗎?

                I want to create GridLayout in Kivy with many rectangle buttons with some custom images with different size. To do so, I want to scale image (the way I wan to do this is shown below) and then crop/hide the parts that overflow the widget borders. The resizing works nice, but I can not figure out how to hide/crop that parts which are outside the rectangle. For example: if widget have dimensions of 10px x 10px and my image is 100px x 200px I will rezise it to 10px x 20px and center it in widget, but the 5px below and abowe will be visible. I do not want that. :) Cloud somebody help me with this problem?

                class PlaceIcon(Widget):
                    def __init__(self,image_path, **kwargs):
                        super(PlaceIcon, self).__init__(**kwargs)
                        self.bind(size=self.adjust_size)
                        self.image = Image(source=image_path)
                        self.image_path = image_path  
                
                    def adjust_size(self,*args):
                        (a,b) = self.image.texture.size
                        (x,y) = self.size
                        (x1,y1) = self.pos
                        if x > y:
                            scale = x/a
                        else:
                            scale = y/b
                        x1 -= (scale*a-x)/2
                        y1 -= (scale*b-y)/2
                        with self.canvas:
                            self.canvas.clear()
                            self.background = Rectangle(texture=self.image.texture, pos=(x1,y1), size=(scale*a,scale*b))
                

                推薦答案

                我會說看看Texture.get_region:http://kivy.org/docs/api-kivy.graphics.texture.html#kivy.graphics.texture.Texture.get_region

                I would say to look at Texture.get_region: http://kivy.org/docs/api-kivy.graphics.texture.html#kivy.graphics.texture.Texture.get_region

                因此,您可以只使用要顯示和傳遞的紋理部分,就好像它是完全不同的紋理一樣.

                So you can use only the part of the texture you want to display and passing as if it was an entirely different texture.

                另一種方法是使用 StencilView,但我認為這里的 get_region 更好.

                Another way would be to use StencilView, but i think here the get_region is better.

                這篇關于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 - 自動更改角色顏色)
                <legend id='foQYw'><style id='foQYw'><dir id='foQYw'><q id='foQYw'></q></dir></style></legend>

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

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

                    <tfoot id='foQYw'></tfoot>
                      <tbody id='foQYw'></tbody>

                          <bdo id='foQYw'></bdo><ul id='foQYw'></ul>
                        • 主站蜘蛛池模板: 日韩精品一区二区在线观看 | 久久精品免费 | 精品久久久久久久 | 国户精品久久久久久久久久久不卡 | 免费在线一区二区 | 黄视频免费| 欧美一区免费 | 特黄视频 | 天天夜干 | 日本亚洲欧美 | 欧美黄色绿像 | 综合视频在线 | 黄免费在线 | 精品在线一区 | 9999国产精品欧美久久久久久 | 日批免费在线观看 | 国产91亚洲精品一区二区三区 | av永久| 国产色| 日韩一区二区久久 | 国内av在线 | 亚洲精品高清视频 | 综合另类 | 欧美一区成人 | 91久久久久久| 在线成人免费av | 国产精品一区二区av | 午夜免费视频 | 精品在线 | 国产精品一区二区久久 | 91不卡在线 | 碰碰视频 | 99综合网| 日本一二三区在线观看 | 亚洲高清一区二区三区 | 91视频91 | 国产在线不卡视频 | 视频精品一区 | 亚洲黄色高清视频 | 中文字幕第一页在线 | 一级毛片免费看 |