<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: TobiasHT</title>
    <description>The latest articles on DEV Community by TobiasHT (@htthomas).</description>
    <link>https://dev.to/htthomas</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F406946%2F8cdbfc4d-cee9-45d7-80a0-5a613eb02659.jpg</url>
      <title>DEV Community: TobiasHT</title>
      <link>https://dev.to/htthomas</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/htthomas"/>
    <language>en</language>
    <item>
      <title>Starting my Journey to contributing to Python</title>
      <dc:creator>TobiasHT</dc:creator>
      <pubDate>Tue, 28 Dec 2021 11:22:31 +0000</pubDate>
      <link>https://dev.to/htthomas/starting-my-journey-to-contributing-to-python-1589</link>
      <guid>https://dev.to/htthomas/starting-my-journey-to-contributing-to-python-1589</guid>
      <description>&lt;p&gt;Hey Devs.&lt;br&gt;
So I've been using Python for quite a long time now. I have used it in a variety of projects, some open source while other proprietary, all ranging from graphics, to web, to data science and many other sectors in IT.&lt;br&gt;
I'm mainly a freelancer at this point, so that's why I get to work on a wide range of projects.&lt;/p&gt;

&lt;p&gt;However, this month I decided to take a big step and try to contribute to CPython. CPython is the most common implementation of python for those that don't know it, other implementations include PyPy, IronPyton and Jython, you can look them up if you wanna know more about them. We're here to talk about CPython mainly and how to get started. &lt;/p&gt;

&lt;p&gt;Rest assured, other than using the language itself, I generally have no idea how CPython is implemented, and I'm also not 100% good at Python itself, I'd give myself 85%. So I'm gonna start documenting my journey through a series of blog posts that I'm gonna be making here. I hope by the end of this journey, I'd have achieved my goal of contributing to CPython, and I hope we move together in this awesome Journey.&lt;/p&gt;

&lt;p&gt;So now where I'm starting from you wonder? Well, I started where everyone who wishes to contribute to python starts from, the python devguide &lt;a href="https://devguide.python.org/"&gt;https://devguide.python.org/&lt;/a&gt; and I read through it quite carefully.&lt;br&gt;
Second, I needed to learn how python works on the inside, and for that I purchased my copy of CPython Internals by Anthony Shaw, this is quite a great book I might say.&lt;br&gt;
Thirdly, I had to get myself a copy of the CPython source code from GitHub, which I downloaded as a zip from here &lt;a href="https://github.com/python/cpython"&gt;https://github.com/python/cpython&lt;/a&gt; .I downloaded the recent Python 3.10 source. I did not want to clone the python 3.11 project because it is continuously changing and I wouldn't be able to keep up with the changes.&lt;br&gt;
Fourthly, I needed to find a community of developers where I can ask questions when I face a challenge. Thankfully, I landed on the Python discussions site &lt;a href="https://discuss.python.org/"&gt;https://discuss.python.org/&lt;/a&gt; . This is the place where core developers and New users sit back and talk python all day (that's if they got time to talk).&lt;/p&gt;

&lt;p&gt;Well, I think my ingredients are set. Since the year is coming to a close, I guess there's not much I can do this year. However, before this year ends, I realized that It's important to learn how to embed and extend python and also learning the Python-C API. This is very useful to learn as it gives you a glimpse into the internals of CPython and also has a wide range of applications in cases where you wanna add extra functionality to your python interpreter.&lt;/p&gt;

&lt;p&gt;Alright, that's it for me for now. Next up, learning the Python-C API and how to extend python with some C code. If you wanna follow along, you can find the Python-C API documented in the python docs. Happy learning, and let's start off with the journey.&lt;/p&gt;

</description>
      <category>python</category>
    </item>
    <item>
      <title>Introduction to the Kivy development cycle, KIVY 2.0</title>
      <dc:creator>TobiasHT</dc:creator>
      <pubDate>Tue, 22 Jun 2021 22:11:36 +0000</pubDate>
      <link>https://dev.to/htthomas/introduction-to-the-kivy-development-cycle-kivy-2-0-h02</link>
      <guid>https://dev.to/htthomas/introduction-to-the-kivy-development-cycle-kivy-2-0-h02</guid>
      <description>&lt;p&gt;Hello Devs, This is the second article I'm writing about how to develop mobile apps with Python and the kivy framework. &lt;br&gt;
Last time we talked a little about kivy and we were able to compare it with other mobile frameworks. We also compared it to flutter and saw the valuable advantages it has over it.&lt;br&gt;
Today, we're starting our first phase of learning the actual Kivy framework.&lt;/p&gt;
&lt;h3&gt;
  
  
  Kivy in a nutshell
&lt;/h3&gt;

&lt;p&gt;Let's talk about Kivy's structure for a second.&lt;br&gt;
Kivy is built on top of SDL2, a powerful C graphics library. The link between the SDL2 C code and the Python code built on top of it is built using Cython. &lt;br&gt;
The kivy project folder contains various python modules. You will not be able to interact with all these modules directly, because some of them are abstract and are used to implement concrete modules.&lt;br&gt;
That being said, the main modules in the kivy package that you will interact with the most are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;app&lt;/li&gt;
&lt;li&gt;uix&lt;/li&gt;
&lt;li&gt;graphics&lt;/li&gt;
&lt;li&gt;lang&lt;/li&gt;
&lt;li&gt;core&lt;/li&gt;
&lt;li&gt;properties&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Proceeding, those aren't the only modules you will need to build an optimized app. However, they are the basic parts you'll not miss out while building any app in Kivy. But what exactly is contained in these modules, let's find out.&lt;/p&gt;
&lt;h4&gt;
  
  
  app
&lt;/h4&gt;

&lt;p&gt;The app module contains the &lt;strong&gt;App&lt;/strong&gt; class.&lt;br&gt;
The App class is the main entry point for a user into your application. It runs the entire application loop that the user will interact with. Import the App class as shown below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;kivy.app&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;App&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if you're using python interactively, you'll see something like this on &lt;strong&gt;Windows&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Myw0GoXd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cw6oi3ccpc3etuaovn7q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Myw0GoXd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cw6oi3ccpc3etuaovn7q.png" alt="first-kivy-import"&gt;&lt;/a&gt;&lt;br&gt;
Kivy will start up some dependencies that it relies on such as SDL2, Gstreamer and many others. Once the loading process is done, now you can start building some UI elements.&lt;/p&gt;
&lt;h4&gt;
  
  
  uix
&lt;/h4&gt;

&lt;p&gt;The uix module is one of the biggest kivy modules. It contains the implementations of all of Kivy's UI elements suchs as buttons,labels,text inputs and many others.&lt;br&gt;
The uix module contains submodules that are written in small letters. The submodules contain classes with the same name as the submodule, but with the first letters capitalized.&lt;br&gt;
for example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;kivy.uix.button&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Button&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;kivy.uix.label&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Label&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;kivy.uix.boxlayout&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BoxLayout&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The widgets in the uix module are divided into the Display widgets and the layout widgets.&lt;br&gt;
The display widgets are the ones that physically appear on the user's screen while the layout widgets provide means to organize the display widgets in a certain pattern.&lt;br&gt;
For example, the &lt;strong&gt;boxlayout&lt;/strong&gt; organizes widgets vertically or horizontally, the &lt;strong&gt;gridlayout&lt;/strong&gt; organizes widgets in rows and columns and other layouts organize widgets in various ways.&lt;/p&gt;
&lt;h4&gt;
  
  
  use what we have so far
&lt;/h4&gt;

&lt;p&gt;Lets see how we can display a simple button in kivy.&lt;br&gt;
here we go&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;kivy.app&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;App&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;kivy.uix.button&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Button&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ButtonApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;App&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"my-first-button"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;ButtonApp&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;run&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alright, if you very new to a framework, seeing code like this might throw you off a little. This is actually simple code to read, but the questions on how it works are the most aching. Let me try to answer some here.&lt;br&gt;
First, we imported our App class like we discussed above. However, this class is an abstract class, that is, it has "empty" methods that need to be implemented by the subclass or child class.&lt;br&gt;
One of those abstract methods is the &lt;strong&gt;build&lt;/strong&gt; method. This method returns the root widget of the Kivy application that shall be ran.&lt;br&gt;
In our build method, we returned a button widget as our root widget with "my-first-button" as our display text.&lt;br&gt;
Finally, we used the standard default conditional statement to run the script and we called the &lt;strong&gt;run&lt;/strong&gt; method of our ButtonApp. the run method is actually implemented in the App abstracted class which we subclassed.&lt;br&gt;
Once we run this script, we get a big gray button that fills up the entire app window. The button turns blue when pressed and changes back to gray when released.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H6jZW5ct--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2aqvrbdt5i78tq6n0sxf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H6jZW5ct--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2aqvrbdt5i78tq6n0sxf.png" alt="kivy button"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  conclusion
&lt;/h4&gt;

&lt;p&gt;That's it for today. I've just merely given you a glimpse about kivy. It surely gets more complicated than that. However once you master this framework, the apps you'll build will be incredible.&lt;br&gt;
We shall keep discussing the rest of the modules as time goes on. For today however, this is where it ends&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>python</category>
    </item>
    <item>
      <title>KIVY INDEPTH SERIES, KIVY 2.0</title>
      <dc:creator>TobiasHT</dc:creator>
      <pubDate>Sat, 12 Jun 2021 12:05:23 +0000</pubDate>
      <link>https://dev.to/htthomas/kivy-indepth-series-kivy-2-0-4na1</link>
      <guid>https://dev.to/htthomas/kivy-indepth-series-kivy-2-0-4na1</guid>
      <description>&lt;p&gt;Hello there, My Name is Higenyi Tobias Thomas, but you can just refer to me as Tobias HT. &lt;br&gt;
I am a programmer and have been coding in mainly Python and C for the past 6 years.&lt;br&gt;
I deeply fell in love with python, it had everything I ever needed. However, there was mainly one problem. Other than the developer community, many software users detest the use of commandline interfaces, and others are even afraid of them.&lt;br&gt;
Also software users love beautiful and interactive graphical user interfaces that Python's default GUI suite(Tkinter) and others simply cannot offer.&lt;/p&gt;

&lt;p&gt;That's why I'm presenting to you, &lt;strong&gt;KIVY 2.0.0.&lt;/strong&gt;&lt;br&gt;
Kivy is a beautiful, cross platform library that adds a professional look to your GUI applications. Version 2.0 was released in December 2020, and it's the latest release that comes with major bugfixes, faster speed improvements and much more. &lt;br&gt;
It has a rich support for multimedia such as Images and videos of various formats. It provides a consistent look and feel of your app over all major mobile and desktop platforms.&lt;br&gt;
You can checkout more about kivy &lt;a href="https://kivy.org/#home"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;My Job here is to make you a pro at the kivy framework. We are going to learn how to develop beautiful apps and also how to compile them for both desktop and mobile. I shall be using the windows platform for desktop and Android for mobile. The examples shall be sufficient to compile to both iOS and MacOS. I do assume though, that you are sufficiently good at the python programming language, that's what we're gonna be using. Without further ado, let's dive in.&lt;/p&gt;

&lt;h3&gt;
  
  
  comparison between Kivy and flutter
&lt;/h3&gt;

&lt;p&gt;Before we dive deeper into kivy, I'm sure you're wondering why you would rather choose kivy instead of the hundreds of other frameworks out there that can do the same job, most notably the flutter framework. Well, here is a couple of reasons why.&lt;/p&gt;

&lt;h5&gt;
  
  
  Language in use
&lt;/h5&gt;

&lt;p&gt;Kivy uses Python language for development of apps, Python has been battle tested, very fast, and easy to learn. It's used in the highly computational field of Artificial intelligence and Machine Learning and other fields of Science. Flutter on the other hand uses Dart language, a relatively new language that is still under going various tests and not really recommended for large scale production because of it's high volatility.&lt;/p&gt;

&lt;h5&gt;
  
  
  Rendering Engine
&lt;/h5&gt;

&lt;p&gt;Kivy uses the SDL2 Engine, a very powerful GPU based rendering engine to display the user interface. The advantage of using sdl2 is that all the graphics that are displayed on screen are created by the fast GPU. On the other hand, Flutter uses the Skia Engine, a very powerful CPU based rendering engine. The skia engine is great when it gets to render simple user interfaces, however due to it's CPU constraint, it doesn't do well when it gets to rendering intensive apps like 3D games, simulations and more.&lt;/p&gt;

&lt;h5&gt;
  
  
  FrameRates
&lt;/h5&gt;

&lt;p&gt;Kivy has a minimum framerate of around 75 frames per second, which immerses the user in a fluid app experience with almost Zero latency. This frame rate can go up 125 frames per second. while flutter provides a frame rate of 60 frames per second and barely any chance of increasing the rate speed. This is the major cause of the latency in the user experience of flutter apps.&lt;/p&gt;

&lt;h5&gt;
  
  
  App size
&lt;/h5&gt;

&lt;p&gt;Kivy framework produces very light weight, highly compact and extremely fast App bundles for all the major platforms. Flutter on the other hand produces large app bundles which are almost twice and in worse cases, three times bigger than the ones produced by Kivy.&lt;/p&gt;

&lt;h5&gt;
  
  
  Native platform interaction
&lt;/h5&gt;

&lt;p&gt;All frameworks have to be able to provide a way an app can interact with the system features of the underlying native platform. Kivy provides a simple way to call native android and iOS system calls with in the app through a Java Bridge and Objective C bridge which is extremely fast. Flutter on the other hand provides a message passing solution where the flutter app calls to native code and acquires results through a simple message. This is relatively slow compared to kivy.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;I could write about the differences between kivy and other platforms as well, but that will be much talk and yet we need to get down into business. Instead of telling you why Kivy is better, I am going to show you why.&lt;br&gt;
This has just been the introduction to this series and you should expect much more.&lt;br&gt;
The next 5 articles will include:&lt;br&gt;
     1) introduction to the kivy app development cycle&lt;br&gt;
     2) introduction to kivy widgets&lt;br&gt;
     3) introduction to kivy events&lt;br&gt;
     4) introduction to kivy graphics&lt;br&gt;
     5) compiling kivy apps for mobile and desktop&lt;/p&gt;

</description>
      <category>python</category>
      <category>mobile</category>
    </item>
    <item>
      <title>Python is a Superpower. Industries that are using Python today</title>
      <dc:creator>TobiasHT</dc:creator>
      <pubDate>Thu, 05 Nov 2020 05:36:09 +0000</pubDate>
      <link>https://dev.to/htthomas/python-is-a-superpower-industries-that-are-using-python-today-3jl3</link>
      <guid>https://dev.to/htthomas/python-is-a-superpower-industries-that-are-using-python-today-3jl3</guid>
      <description>&lt;p&gt;Python language has proved to be the Superpower of computing these days. Even when a lot of critics come out to speak against it, it still persists and infact grows even stronger, why is that?&lt;br&gt;
First of all, python has the easiest syntax in the world, it's literally just plain text. So it's easy to grasp.&lt;br&gt;
Secondly, it doesn't have a lot of tricks behind it, you can literally master the whole entire python language in a matter of days.&lt;br&gt;
Thirdly, Python is not really that fast, but the power it has to be highly extensible and embeddable adds extra boost to it's speed using tools like cython.&lt;/p&gt;

&lt;p&gt;For that reason, Python has been used in very many industries, here's a afew.&lt;br&gt;
As a graphics major, python has become the de facto language for graphics scripting with industry standard software such as Houdini, Autodesk Maya, 3DsMax, Blender and so many others use Python for scripting.&lt;br&gt;
Google's search is actually built with python.&lt;br&gt;
Almost all Artificial intelligence tools today are built with Python including Tensorflow and Pytorch which are the leading standards.&lt;br&gt;
Reports have also noted a large increase in malicious software written in Python, this means that system security and encryption is being developed and tested in Python these days.&lt;br&gt;
Python is coming to mobile, with open source projects like Kivy and BeeWare pushing the boundaries to Port Python to all the major mobile operating systems. You can actually build mobile apps with Kivy or BeeWare's Toga.&lt;br&gt;
Game scripting is now days done with Python, the most famous is EveOnline built with stackless python.&lt;br&gt;
I could go on and on but I beg to end here, you can include more industries that use Python in the comments below&lt;/p&gt;

</description>
      <category>python</category>
      <category>blockchain</category>
      <category>django</category>
      <category>hacking</category>
    </item>
    <item>
      <title>The return of goto </title>
      <dc:creator>TobiasHT</dc:creator>
      <pubDate>Fri, 31 Jul 2020 09:36:17 +0000</pubDate>
      <link>https://dev.to/htthomas/the-return-of-goto-3k3b</link>
      <guid>https://dev.to/htthomas/the-return-of-goto-3k3b</guid>
      <description>&lt;p&gt;The goto statement is one of the most obscure statements in C and C++. &lt;br&gt;
This could be due to the fact that not a lot of tutorials and books teach about it. But mainly it's due to the mishandling of the goto statement by our ancestor programmers.&lt;br&gt;
This all began when C language had just gained traction. Many assembly programmers hopped on to the C ride and began building complicated programs with the goto statement in C which was more familiar to the goto statement in assembly.&lt;/p&gt;

&lt;p&gt;goto statement works in such a way that it tells your program to execute the section of code that the goto statement points to. This statement may be with in any scope of the code being executed. &lt;br&gt;
The goto statement represents how the CPU actually performs some of it's execution, hence it's more close to the machine.&lt;/p&gt;

&lt;p&gt;However, due to the mishandling of the goto statement by our ancestor assembly programmers, goto was generally shunned by the developer community and it's currently considered bad coding practice to use it.&lt;/p&gt;

&lt;p&gt;But it doesn't have to be that way. In fact all the C and C++ compilers in existence support it anyway, so why not use it. We just have to provide Standard means on how to use them.&lt;/p&gt;

&lt;p&gt;First, among the confusing things done by the ancestor programmers was to declare labels within other functions and have goto statements point to them. This was generally confusing because the function declares it's own local scope, so having another function point to that functions scope was confusing. Mostly because it was hard to find where the goto statement was actually pointing to.&lt;br&gt;
So generally it would be better to make all labels as globally scoped.&lt;/p&gt;

&lt;p&gt;Secondly, the labels themselves should have a standard notation. Pointers in C and C++ are written with _ptr as a suffix and it's a generally accepted notation. Labels can also be written with a _lab suffix to denote that it's a label, for example endProcess_lab could be a label for a section of code that closes a process when an error is encountered.&lt;/p&gt;

&lt;p&gt;I can give many reasons as to why goto statement should return, but it would make this article longer and more tedious to read than it already is. &lt;br&gt;
It's just a polite suggestion to the developer community that I hope shall be put into consideration.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
