Close Menu
    Trending
    • Finding the right tool for the job: Visual Search for 1 Million+ Products | by Elliot Ford | Kingfisher-Technology | Jul, 2025
    • How Smart Entrepreneurs Turn Mid-Year Tax Reviews Into Long-Term Financial Wins
    • Become a Better Data Scientist with These Prompt Engineering Tips and Tricks
    • Meanwhile in Europe: How We Learned to Stop Worrying and Love the AI Angst | by Andreas Maier | Jul, 2025
    • Transform Complexity into Opportunity with Digital Engineering
    • OpenAI Is Fighting Back Against Meta Poaching AI Talent
    • Lessons Learned After 6.5 Years Of Machine Learning
    • Handling Big Git Repos in AI Development | by Rajarshi Karmakar | Jul, 2025
    AIBS News
    • Home
    • Artificial Intelligence
    • Machine Learning
    • AI Technology
    • Data Science
    • More
      • Technology
      • Business
    AIBS News
    Home»Artificial Intelligence»Mobile App Development with Python | Towards Data Science
    Artificial Intelligence

    Mobile App Development with Python | Towards Data Science

    Team_AIBS NewsBy Team_AIBS NewsJune 11, 2025No Comments8 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    Mobile App Development is the method of constructing an utility for cell gadgets, reminiscent of smartphones and tablets. Usually, cell apps are more durable to develop than internet apps, as a result of they have to be designed from scratch for every platform, whereas internet growth shares frequent codes throughout totally different gadgets.

    Every working system has its personal language used for coding a native app (one created with know-how devoted to a particular platform). For example, Android makes use of Java, whereas iOS makes use of Swift. Often, 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 methods.

    Cellular App Improvement is very related for AI because it permits the combination of latest applied sciences into individuals each day life. LLMs are so common 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 learn how to construct a cross-platform cell 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 cell apps, whereas KivyMD is the library that leverages Google’s Material Design and makes the utilization of this framework a lot simpler (much like Bootstrap for internet dev).

    ## for growth
    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:

    • essential.py (the title have to be this) which shall comprise the Python code of the app, mainly the back-end
    • parts.kv (you possibly can name it otherwise) which shall comprise all of the Kivy code used for the app structure, you possibly can see it because the front-end

    Then, within the essential.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 applying 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 making an attempt to recollect shuffled data. As a matter of reality, I’m utilizing it to memorize Chinese language vocabulary.

    As you possibly can see from the picture, I’m going to incorporate:

    • an intro display screen to show the brand
    • a house display screen that may redirect to the opposite screens
    • a display screen to avoid wasting phrases
    • a display screen to view and delete saved data
    • a display screen to play the sport.

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

    In an effort to embrace Kivy file within the app, we have to load it from the essential.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("parts.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 difficult function: db administration by way of cell. That’s why we’re going to use additionally the native Python bundle for databases:

    import sqlite3

    Improvement — fundamentals

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

    I take into account that simple as a result of it doesn’t require any Python code, it may be dealt with by the parts.kv file. The change of display screen triggered by the button have to be linked to the basis like this:

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

    You’ll have seen that on high of the display screen 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 screen it’s only a easy icon, however on the opposite screens it will likely be an icon button used to carry you again to the Residence Display from another display screen of the app.

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

    Improvement — superior

    Let’s step up our recreation and take care of the DB by way of the Save Display. It should enable the person to avoid wasting totally different phrases for various classes (i.e. to review a number of languages). That suggests: 

    • 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 avoid wasting the shape, so writing a brand new row within the DB.

    If you run the app for the primary time, the DB have to be created. We are able to do this in the principle 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("parts.kv")

    The difficult half is the DB icon that, when pushed, reveals all the present classes and permits the choice of one. Within the parts.kv file, beneath 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 principle app.

    That operate is outlined within the essential.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 screen supervisor calls the display screen with get_screen() and identifies the merchandise by id:

    When the person enters the Save Display, the class variable needs to 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 screen 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 avoid wasting the shape (by pushing the button).

    In an effort to ensure 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 up to now, I’m assured that you just’re capable of undergo the complete code and perceive what’s happening. The logic of the opposite screens is fairly related.

    Check

    You may check the app on the iOS simulator on MacBook, that replicates an iPhone setting with no need a bodily iOS gadget.

    Xcode must be put in. Begin by opening the terminal and operating 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 title 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 wish 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 learn how to design and construct a cross-platform cell app with Python. I used Kivy to design the person interface and I confirmed learn how to make it obtainable for iOS gadgets. Now you can also make your personal cell apps with Python and Kivy.

    Full code for this text: GitHub

    I hope you loved it! Be happy to contact me for questions and suggestions or simply to share your fascinating tasks.

    👉 Let’s Connect 👈

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



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleIs Medium Dying? A Simple Breakdown of Why the Platform Is Waning | by Kaushal Kumar | Jun, 2025
    Next Article Why the Franchise Industry Has Its Own Day Now
    Team_AIBS News
    • Website

    Related Posts

    Artificial Intelligence

    Become a Better Data Scientist with These Prompt Engineering Tips and Tricks

    July 1, 2025
    Artificial Intelligence

    Lessons Learned After 6.5 Years Of Machine Learning

    July 1, 2025
    Artificial Intelligence

    Prescriptive Modeling Makes Causal Bets – Whether You Know it or Not!

    June 30, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    Finding the right tool for the job: Visual Search for 1 Million+ Products | by Elliot Ford | Kingfisher-Technology | Jul, 2025

    July 1, 2025

    I Tried Buying a Car Through Amazon: Here Are the Pros, Cons

    December 10, 2024

    Amazon and eBay to pay ‘fair share’ for e-waste recycling

    December 10, 2024

    Artificial Intelligence Concerns & Predictions For 2025

    December 10, 2024

    Barbara Corcoran: Entrepreneurs Must ‘Embrace Change’

    December 10, 2024
    Categories
    • AI Technology
    • Artificial Intelligence
    • Business
    • Data Science
    • Machine Learning
    • Technology
    Most Popular

    How to Find the Right Distribution for Your Data

    June 5, 2025

    I’m an SEO Expert — Here Are 6 Content Tips to Stand Out in Any Saturated Market

    December 31, 2024

    User Experiences with AI Girlfriend Chatbots: Success Stories and Challenges

    May 26, 2025
    Our Picks

    Finding the right tool for the job: Visual Search for 1 Million+ Products | by Elliot Ford | Kingfisher-Technology | Jul, 2025

    July 1, 2025

    How Smart Entrepreneurs Turn Mid-Year Tax Reviews Into Long-Term Financial Wins

    July 1, 2025

    Become a Better Data Scientist with These Prompt Engineering Tips and Tricks

    July 1, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Business
    • Data Science
    • Machine Learning
    • Technology
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2024 Aibsnews.comAll Rights Reserved.

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