Close Menu
    Facebook LinkedIn YouTube WhatsApp X (Twitter) Pinterest
    Trending
    • Today’s NYT Connections Hints, Answers for April 21 #1045
    • High-Endurance ASW and Strike USV
    • The competition watchdog just got a seat at the table in the legal battle between Epic Games and Apple
    • War Memes Are Turning Conflict Into Content
    • OnePlus Reveals New Phones Despite Uncertain Future
    • KTM Freeride E now street legal in all 50 US states
    • Unknown knowns: Techboard dug up unannounced startup investments – and discovered it’s potentially the majority of funding
    • Ben McKenzie Says Crypto Has a Secret Ingredient: Male Loneliness
    Facebook LinkedIn WhatsApp
    Times FeaturedTimes Featured
    Tuesday, April 21
    • Home
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    • More
      • AI
      • Robotics
      • Industries
      • Global
    Times FeaturedTimes Featured
    Home»Artificial Intelligence»Mobile App Development with Python | Towards Data Science
    Artificial Intelligence

    Mobile App Development with Python | Towards Data Science

    Editor Times FeaturedBy Editor Times FeaturedJune 11, 2025No Comments8 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr WhatsApp Email
    Share
    Facebook Twitter LinkedIn Pinterest Telegram Email WhatsApp Copy Link


    Mobile App Development is the method of constructing an software for cellular units, similar to smartphones and tablets. Typically, cellular apps are more durable to develop than internet apps, as a result of they should be designed from scratch for every platform, whereas internet improvement shares widespread codes throughout totally different units.

    Every working system has its personal language used for coding a native app (one created with know-how devoted to a selected platform). For example, Android makes use of Java, whereas iOS makes use of Swift. Normally, it’s higher to make use of the devoted tech for apps that require excessive efficiency, like gaming or heavy animations. Quite the opposite, hybrid apps use cross-platform languages (i.e. Python) that may be run on a number of working techniques.

    Cell App Growth is extremely related for AI because it allows the mixing of recent applied sciences into individuals day by day life. LLMs are so in style now as a result of they’ve been deployed into user-friendly apps in your cellphone, simply accessible anytime and wherever.

    By way of this tutorial, I’ll clarify methods to construct a cross-platform cellular app with Python, utilizing my Memorizer App for instance (hyperlink to full code on the finish of the article).

    Setup

    I’m going to use the Kivy framework, which is the most used for mobile development in the Python community. Kivy is an open-source bundle for cellular apps, whereas KivyMD is the library that leverages Google’s Material Design and makes the utilization of this framework a lot simpler (just like Bootstrap for internet dev).

    ## for improvement
    pip set up kivy==2.0.0
    pip set up kivymd==0.104.2
    
    ## for deployment
    pip set up Cython==0.29.27
    pip set up kivy-ios==1.2.1

    The very first thing to do is to create 2 recordsdata:

    • principal.py (the identify should be this) which shall comprise the Python code of the app, principally the back-end
    • elements.kv (you’ll be able to name it in another way) which shall comprise all of the Kivy code used for the app structure, you’ll be able to see it because the front-end

    Then, within the principal.py file we import the bundle to initialize an empty app:

    from kivymd.app import MDApp
    
    class App(MDApp):
       def construct(self):        
           self.theme_cls.theme_style = "Mild"        
           return 0
    
    if __name__ == "__main__":    
       App().run()

    Earlier than we begin, I shall briefly describe the appliance I’m constructing. It’s a easy app that helps to memorize stuff: the person inserts pair of phrases (i.e. one thing in English and the equal in one other language, or a date and the historic occasion linked to that). Then, the person can play the sport by attempting to recollect shuffled info. As a matter of truth, I’m utilizing it to memorize Chinese language vocabulary.

    As you’ll be able to see from the picture, I’m going to incorporate:

    • an intro display to show the brand
    • a house display that may redirect to the opposite screens
    • a display to save lots of phrases
    • a display to view and delete saved info
    • a display to play the sport.

    So, we will write all of them down within the elements.kv file:

    With a view to embody Kivy file within the app, we have to load it from the principal.py with the builder class, whereas the screen class hyperlinks the screens between the 2 recordsdata.

    from kivymd.app import MDApp
    from kivy.lang import Builder
    from kivy.uix.screenmanager import Display
    
    class App(MDApp):
       def construct(self):        
           self.theme_cls.theme_style = "Mild"        
           return Builder.load_file("elements.kv")
    
    class IntroScreen(Display):    
       go 
    
    class HomeScreen(Display):    
       go 
    
    class PlayScreen(Display):
       go  
     
    class SaveScreen(Display):    
       go 
    
    class EditScreen(Display):
       go
    
    if __name__ == "__main__":    
       App().run()

    Please notice that even when the app itself is primary, there’s a fairly tough characteristic: db administration by way of cellular. That’s why we’re going to use additionally the native Python bundle for databases:

    import sqlite3

    Growth — fundamentals

    We’re gonna heat up with the Intro Display: it merely accommodates an image logo, some text labels, and a button to maneuver to a different display.

    I think about that simple as a result of it doesn’t require any Python code, it may be dealt with by the elements.kv file. The change of display triggered by the button should be linked to the basis like this:

    The identical goes for the House Display: because it’s only a redirect, it may be all managed with Kivy code. You simply need to specify that the display will need to have 1 icon and three buttons.

    You’ll have observed that on high of the display there’s a “house” icon. Please notice that there’s a distinction between a simple icon and an icon button: the latter is pushable. On this display it’s only a easy icon, however on the opposite screens will probably be an icon button used to convey you again to the House Display from another display of the app.

    Once we use an icon, now we have to supply the tag (i.e. “house” shows a bit home). I discover this code very helpful, simply run it and it’ll present all of the out there icons.

    Growth — superior

    Let’s step up our recreation and cope with the DB by way of the Save Display. It should enable the person to save lots of totally different phrases for various classes (i.e. to review a number of languages). That means: 

    • selecting an current class (i.e. Chinese language), so querying the present ones
    • creating a brand new class (i.e. French)
    • two textual content inputs (i.e. a phrase and its translation)
    • a button to save lots of the shape, so writing a brand new row within the DB.

    Whenever you run the app for the primary time, the DB should be created. We are able to try this in the primary operate of the app. For comfort, I’m going so as to add additionally one other operate that queries the DB with any SQL you go on.

    class App(MDApp):
    
       def query_db(self, q, information=False):        
           conn = sqlite3.join("db.db")        
           db = conn.cursor()        
           db.execute(q)        
           if information is True:            
               lst_tuples_rows = db.fetchall()        
           conn.commit()        
           conn.shut()        
           return lst_tuples_rows if information is True else None
    
       def construct(self):        
           self.theme_cls.theme_style = "Mild"
           q = "CREATE TABLE if not exists SAVED (class textual content, left
                textual content, proper textual content, distinctive (class,left,proper))"      
           self.query_db(q)
           return Builder.load_file("elements.kv")

    The tough half is the DB icon that, when pushed, exhibits all the present classes and permits the number of one. Within the elements.kv file, below the Save Display (named “save”), we add an icon button (named “category_dropdown_save”) that, if pressed, launches the Python dropdown_save() operate from the primary app.

    That operate is outlined within the principal.py file and returns a dropdown menu such that, when an merchandise is pressed it will get assigned to a variable named “class”.

    That final line of code hyperlinks the class variable with the label that seems within the front-end. The display supervisor calls the display with get_screen() and identifies the merchandise by id:

    When the person enters the Save Display, the class variable must be null till one is chosen. We are able to specify the properties of the screen when one enters and when one leaves. So I’m going so as to add a operate within the display class that empties the App variable.

    class SaveScreen(Display):    
       def on_enter(self):        
           App.class = ''

    As soon as the class is chosen, the person can insert the opposite textual content inputs, that are required to save lots of the shape (by pushing the button).

    With a view to be sure that the operate doesn’t save if one of many inputs is empty, I’ll use a dialog box.

    from kivymd.uix.dialog import MDDialog
    
    class App(MDApp):    
      dialog = None     
      
      def alert_dialog(self, txt):        
         if not self.dialog:            
            self.dialog = MDDialog(textual content=txt)        
         self.dialog.open()        
         self.dialog = None
    
      def save(self):
         self.class = self.root.get_screen('save').ids.class.textual content  
              if self.class == '' else self.class            
         left = self.root.get_screen('save').ids.left_input.textual content            
         proper = self.root.get_screen('save').ids.right_input.textual content            
         if "" in [self.category.strip(), left.strip(), right.strip()]:                
              self.alert_dialog("Fields are required")            
         else:                
              q = f"INSERT INTO SAVED VALUES('{self.class}',
                    '{left}','{proper}')"                
              self.query_db(q)                
              self.alert_dialog("Saved")                  
              self.root.get_screen('save').ids.left_input.textual content = ''                
              self.root.get_screen('save').ids.right_input.textual content = ''                
              self.class = ''

    After studying to date, I’m assured that you simply’re in a position to undergo the complete code and perceive what’s occurring. The logic of the opposite screens is fairly comparable.

    Check

    You may check the app on the iOS simulator on MacBook, that replicates an iPhone setting while not having a bodily iOS system.

    Xcode must be put in. Begin by opening the terminal and working the next instructions (the final one will take about half-hour):

    brew set up autoconf automake libtool pkg-config
    
    brew hyperlink libtool
    
    toolchain construct kivy

    Now determine your app identify and use it to create the repository, then open the .xcodeproj file:

    toolchain create yourappname ~/some/path/listing
    
    open yourappname-ios/yourappname.xcodeproj

    Lastly, if you’re working with iOS and also you need to check an app in your cellphone after which publish it on the App Retailer, Apple requires you to pay for a developer account.

    Conclusion

    This text has been a tutorial to reveal methods to design and construct a cross-platform cellular app with Python. I used Kivy to design the person interface and I confirmed methods to make it out there for iOS units. Now you may make your individual cellular apps with Python and Kivy.

    Full code for this text: GitHub

    I hope you loved it! Be at liberty to contact me for questions and suggestions or simply to share your attention-grabbing tasks.

    👉 Let’s Connect 👈

    (All photos, until in any other case famous, are by the creator)



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Editor Times Featured
    • Website

    Related Posts

    The LLM Gamble | Towards Data Science

    April 21, 2026

    Context Payload Optimization for ICL-Based Tabular Foundation Models

    April 21, 2026

    What Does the p-value Even Mean?

    April 20, 2026

    From Risk to Asset: Designing a Practical Data Strategy That Actually Works

    April 20, 2026

    Will Humans Live Forever? AI Races to Defeat Aging

    April 20, 2026

    KV Cache Is Eating Your VRAM. Here’s How Google Fixed It With TurboQuant.

    April 19, 2026

    Comments are closed.

    Editors Picks

    Today’s NYT Connections Hints, Answers for April 21 #1045

    April 21, 2026

    High-Endurance ASW and Strike USV

    April 21, 2026

    The competition watchdog just got a seat at the table in the legal battle between Epic Games and Apple

    April 21, 2026

    War Memes Are Turning Conflict Into Content

    April 21, 2026
    Categories
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    About Us
    About Us

    Welcome to Times Featured, an AI-driven entrepreneurship growth engine that is transforming the future of work, bridging the digital divide and encouraging younger community inclusion in the 4th Industrial Revolution, and nurturing new market leaders.

    Empowering the growth of profiles, leaders, entrepreneurs businesses, and startups on international landscape.

    Asia-Middle East-Europe-North America-Australia-Africa

    Facebook LinkedIn WhatsApp
    Featured Picks

    Data Center DC Embraces 800V Power Shift

    March 24, 2026

    Subaru Solterra EV Debuts Divisive Look for 2026 Model Year

    April 20, 2025

    How to Set the Number of Trees in Random Forest

    May 19, 2025
    Categories
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    Copyright © 2024 Timesfeatured.com IP Limited. All Rights.
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us

    Type above and press Enter to search. Press Esc to cancel.