logo
down
shadow

Python Kivy Canvas wont Update


Python Kivy Canvas wont Update

By : user2955057
Date : November 22 2020, 10:33 AM
around this issue You need to modify the Rectangle instruction (or remove and replace, but modifying is easier):
code :
with self.canvas:
    self.rect = Rectangle(source='image.png')
self.rect.source = 'newImage.png'
<TileWidget>:
    tilesource: ''

    canvas:
        Color:
            rgba: 1, 1, 1, 1
        Rectangle:
            size: self.size
            pos: self.pos
            source: 'image.png'
        Color:
            a: 1 if self.tilesource else 0
        Rectangle:
            size: self.size
            pos: self.pos
            source: self.tilesource
<TileWidget>:
    tilesource: ''
    canvas:
        Color:
            rgba: 1, 1, 1, 1
        Rectangle:
            size: self.size
            pos: self.pos
            source: 'image.png'
        Color:
            a: 1 if self.tilesource else 0
        Rectangle:
            size: self.size
            pos: self.pos
            source: self.tilesource
class TileWidget(Widget):
    def on_touch_down(self, touch):
        if self.collide_point(*touch.pos):
            self.tilesource = '64x64tile.png'
            return True
        return super(TileWidget, self).on_touch_down(touch)


Share : facebook icon twitter icon
Kivy : line color in canvas won't update

Kivy : line color in canvas won't update


By : TheOnlyTas
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I have some trouble setting the color of a line in canvas. , Use parenthesis.
code :
<Drawable>:
    rectangleColor: (1,0,0,1) if self.visible else (0,0,0,0)
Kivy - Update Canvas background with value passed from Python

Kivy - Update Canvas background with value passed from Python


By : Tnm Jero Alim
Date : March 29 2020, 07:55 AM
it helps some times Variables are accessible perfectly fine from outside with e.g builtin names (app for App instance, root for main rule/class, self for current widget's instance). Ids will not work because canvas (before, classic, after) is constructed before anything else is, therefore you won't be able to access ids in a canvas of a widget you build the canvas for.
After the canvas is constructed, then such things as ids work in the way you expect them to work.
code :
from kivy.app import App
from kivy.lang import Builder

kv = '''
BoxLayout:
    variable: 'blob'
    orientation: 'vertical'
    canvas:
        Color:
            rgb: 1, 1, 1
        Rectangle:
            source: app.test  # self.variable
'''


class TestApp(App):
    def build(self):
        self.test = 'path'
        return Builder.load_string(kv)


if __name__ == '__main__':
    TestApp().run()
how to add canvas to Layout(python kivy)

how to add canvas to Layout(python kivy)


By : J Doe
Date : March 29 2020, 07:55 AM
With these it helps The problem is that you are adding the curves to an AnchorLayout that you have created and you have not added to your application, the next line with AnchorLayout().canvas creates a new Anchorlayout. You must do this task in the constructor:
code :
from kivy.app import App
from kivy.graphics import Color,Bezier
from kivy.uix.anchorlayout import AnchorLayout

class AncLayout(AnchorLayout):
    def __init__(self, *args, **kwargs):
        AnchorLayout.__init__(self, *args, **kwargs)
        with self.canvas:
            Color(.1,.88,.71,.57)
            Bezier(points = (100,100,70,70,40,70,100,100),    
                   segments = 120,
                   dash_length = 9,
                   dash_offset = 3)

class MasterApp(App):
    def build(self):
        return AncLayout()  


if __name__ == '__main__':
    MasterApp().run()
Kivy: update matplotlib canvas with a slider

Kivy: update matplotlib canvas with a slider


By : Carlos Velez
Date : March 29 2020, 07:55 AM
it fixes the issue Misunderstood what you wanted (my error). If you do not want to create new plots, but just update the existing one, you only need to add a call to plt.clf() in your add_one() method before you do any additional plotting. This clears the current figure, and allows you to replace it with a new one.
python / kivy .kv file wont read

python / kivy .kv file wont read


By : Aravind Gn
Date : March 29 2020, 07:55 AM
To fix this issue Check whether your MainApp(App) class name is same as your .kv file name without the 'App' (if not make them same) It's not case sensitive. for example: MaNagerApp(App) will load manager.kv
OR
Related Posts Related Posts :
  • ModuleNotFoundError: No module named 'users'
  • Interpolating with multiple y-values
  • Import warning PACKAGE.egg is added to sys.path
  • Is there a key for the default namespace when creating dictionary for use with xml.etree.ElementTree.findall() in Python
  • Using fill_between() with a Pandas Data Series
  • How to build a lookup table for tri-linear interpolation in NumPy?
  • Matrix vector multiplication along array axes
  • Can a cookiejar object be pickled?
  • __init__.py in project folder breaks nose tests
  • Comparing times with sub-second accuracy
  • advanced search using HayStack + Solr in Django?
  • Base test case class for python unittest
  • The PyData Ecosystem
  • Finding unique entries with oldest time stamp
  • Custom filesize format with Python Humanize?
  • Use `tf.image.resize_image_with_crop_or_pad` to resize numpy array
  • Sum number of occurences of string per row
  • Calculating 'Diagonal Distance' in 3 dimensions for A* path-finding heuristic
  • porting PyGST app to GStreamer1.0 + PyGI
  • Connection refused in Tornado test
  • How much time does take train SVM classifier?
  • Turning a string into list of positive and negative numbers
  • Python lists get specific length of elements from index
  • python.exe version 3.3.2 64 & 32 crash while creating .exe file on win 7 64 & 32 with cx_Freeze
  • Efficient nearest neighbour search for sparse matrices
  • django filter_horizontal can't display
  • How to install FLANN and pyflann on Windows
  • How can I plot the same figure standalone and in a subplot in Matplotlib?
  • read-only cells in ipython notebook
  • filling text file with dates
  • error:AttributeError: 'super' object has no attribute 'db_type' when run "python manage.py syncdb" in django
  • python imblearn make_pipeline TypeError: Last step of Pipeline should implement fit
  • Write to csv: columns are shifted when item in row is empty (Python)
  • DuckDuckGo search returns 'List Index out of range'
  • Python function which can transverse a nested list and print out each element
  • Python installing xlwt module error
  • Python mayavi: Adding points to a 3d scatter plot
  • Making a basic web scraper in Python with only built in libraries - Python
  • How to calculate the angle of the sun above the horizon using pyEphem
  • Fix newlines when writing UTF-8 to Text file in python
  • How to convert backward slash command in python to run on Linux
  • PyCharm Code Inspection doesn't include PEP 8
  • How can I use Python namedtuples to insert rows into mySQL database
  • Increase / Decrease Mac Address in Python from String
  • Scrollable QLabel image in PyQt5
  • (Python 2.7) Access variable from class with accessor/mutator
  • Why does "from [Module] import [Something]" takes more time than "import [Module"
  • jira python oauth: how to get the parameters for authentication?
  • Python - How to specify a relative path by jumping a subdirectory?
  • Extract scientific number from string
  • Scrapy: Python cannot find the spider
  • get the values in a given radius from numpy array
  • Is it possible to duplicate a pipe in Python, so that it has one write end but two read ends?
  • Why does wget use Firefox cookies to login on an authenticated webpage?
  • python import behaviour: different objects from same file?
  • Create YoY Graph with Matplotlib
  • Safe use of eval() or alternatives - python
  • Unix change desktop background seamlessly
  • Profiling Python code that uses multiprocessing?
  • How to query a database after render_template
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org