PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, September 12, 2022

[FIXED] How does Kivy achieve cross-platform compatibility?

 September 12, 2022     cross-platform, kivy, python, python-3.x, user-interface     No comments   

Issue

What allows Kivy to be cross-platform compatible?

In other words, how can the same Kivy source code generate apps on multiple kinds of hardware platforms, such as desktop, iOS, and Android?


Solution

I suppose there are two key extremes of achieving cross-platform compatibility:

  1. By implementing things in a different way on each platform so that Kivy is running different code on each one, but hiding that difference from the user by making the output appear the same.
  2. By using external APIs that are supported by all the different platforms, so that Kivy's own code is basically the same and the platforms themselves take care of making it work.

Kivy has a bit of both of these, but in particular all the drawing uses OpenGL ES 2 which is the second type: all of Kivy's drawing logic is just about identical across all supported platforms. Of course there are other types too, e.g. when working out display metrics such as the pixel density Kivy uses a different method on each platform but doesn't expose any of that detail to the user.

Of course things are much more nuanced when considering things as a whole. For instance, Kivy uses SDL2 as a library for creating a window, setting its size/pos handling pause/resume etc., so Kivy's code is of the second type here as it calls SDL2 in the same way on every platform. However, SDL2 is not itself platform-native and is of the first type, implementing its API differently on different platforms but exposing the same API to Kivy on each one.



Answered By - inclement
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing