<?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: Saeed Adam</title>
    <description>The latest articles on DEV Community by Saeed Adam (@saeedulkudry).</description>
    <link>https://dev.to/saeedulkudry</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%2F899086%2Fe7b2b563-24a7-424d-9f25-69600336b0e8.png</url>
      <title>DEV Community: Saeed Adam</title>
      <link>https://dev.to/saeedulkudry</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saeedulkudry"/>
    <language>en</language>
    <item>
      <title>Tkinter Label</title>
      <dc:creator>Saeed Adam</dc:creator>
      <pubDate>Mon, 05 Dec 2022 16:12:06 +0000</pubDate>
      <link>https://dev.to/saeedulkudry/tkinter-label-5cfi</link>
      <guid>https://dev.to/saeedulkudry/tkinter-label-5cfi</guid>
      <description>&lt;p&gt;Label is the most popular Component in Tkinter framework as it is the most useful element that communicates any textual message.&lt;br&gt;
Label is a class, we instantiate it and pass some arguments to transform its behavior. We add style as if we are using css, we can also change font and its weight.&lt;/p&gt;
&lt;h2&gt;
  
  
  Basic Label
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from tkinter import *

window = Tk()

my_label = Label(window, text = "My first app")
my_label.pack()

window.mainloop()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;my_label is a variable that refence the instance of the Label, unless you will not access the object in the future then you don't need an identifier for it. Hence getting rid of the call to .pack() is necessary because of the absence of reference variable for the object.&lt;br&gt;
In that case we may write it as follow.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_label = Label(window, text = "My first app").pack()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first argument indicates the parent of the object, in that case window. If the window has a Frame and you want pack the widget in side the frame, then you mention the frame's identifier as the parent(master).&lt;br&gt;
The second argument is the actual text to display on the window, and is enclosed inside double quotes.&lt;br&gt;
"pack()" is a geometry manager method which makes widget appears on the screen, the other two are grid() and place().&lt;/p&gt;

&lt;p&gt;The code above will output the following result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fajeoikxvoltf0brrivlt.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fajeoikxvoltf0brrivlt.PNG" alt="Image description" width="164" height="123"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The tkinter has some number of arguments that controls the appearance of the text, change the position of the text and add some styles to it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;anchor&lt;/strong&gt;&lt;br&gt;
It specifies the exact position of the text within the size provided to the widget. The default value is CENTER, which is used to center the text within the provided space.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;bg&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The background color displayed behind the text.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;bitmap&lt;/strong&gt;&lt;br&gt;
It is used to set the bitmap to the graphical object specified so that, the label can represent the graphics instead of text.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;bd&lt;/strong&gt;&lt;br&gt;
It represents the width of the border. The default is 2 pixels.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;cursor&lt;/strong&gt;&lt;br&gt;
It tells the mouse pointer to be used when the  cursor is over a widget, i.e., pirate, dot, plus, etc.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;font&lt;/strong&gt;&lt;br&gt;
The font family, size and style  of the text to use. Eg font = ("Arial", 25, "bold"), will give change the font-family to Arial, give the text size of 25 and make the text bold if available.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;fg&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Changes the color of the text using names or Hexadecimal. For the colors name we use the following rule, fg = "color name", and for the Hex we use add hash sign before the color's code, fg = "#ffffff".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;image&lt;/strong&gt;&lt;br&gt;
Sometimes we may like to add images to our apps, the image keyword accepts the PhotoImage instance which hold &lt;br&gt;
s the path to the image.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;justify&lt;/strong&gt;&lt;br&gt;
If the label contains multiple lines of text, the justify keyword changes the orientation of the text . It can be set to LEFT for left justification, RIGHT for right justification, or CENTER for center justification.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;relief&lt;/strong&gt;&lt;br&gt;
Specifies the border type to use. The default value is FLAT. Others are SINKEN, RAISED and RIDGE.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;textvariable&lt;/strong&gt;&lt;br&gt;
We use a control variable to access or change of the text's properties, through get() mothed.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>certification</category>
    </item>
    <item>
      <title>Python Console Calendar</title>
      <dc:creator>Saeed Adam</dc:creator>
      <pubDate>Mon, 05 Dec 2022 16:09:51 +0000</pubDate>
      <link>https://dev.to/saeedulkudry/python-console-calendar-57bi</link>
      <guid>https://dev.to/saeedulkudry/python-console-calendar-57bi</guid>
      <description>&lt;p&gt;Welcome to another tutorial.&lt;br&gt;
Today I will show you how to develop console calendar using python.&lt;/p&gt;

&lt;p&gt;This requires built in method known as "calendar". The module owns a method "month()" which takes two arguments, the year and the exact month which the user want to display.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import calendar  

year = 1999
month = 2
Print ("The Calendar of\n: ", calendar.month(year, month))

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code above outputs as below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The Calendar of                                                     
February 1999
Mo Tu We Th Fr Sa Su
 1  2  3  4  5  6  7
 8  9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To develop a bot, one can accept input from user for a year and a month.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import calendar  

year = int(input ("Please enter the Year: ")) # Holds the year

month = int(input ("Please enter the month: "))    # Holds the month 

# display the calendar  
Print ("The Calendar of: ", calendar.month(year, month))  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;C:\Users\Ameer_studio\Desktop&amp;gt;py cal.py
Please enter the Year: 1999
Please enter the month: 2
The Calendar of:     February 1999
Mo Tu We Th Fr Sa Su
 1  2  3  4  5  6  7
 8  9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Thanks for reading&lt;/em&gt;🙏&lt;/p&gt;

</description>
      <category>python</category>
      <category>tkinetr</category>
      <category>gui</category>
    </item>
    <item>
      <title>Basic Tkinter</title>
      <dc:creator>Saeed Adam</dc:creator>
      <pubDate>Mon, 05 Dec 2022 14:51:15 +0000</pubDate>
      <link>https://dev.to/saeedulkudry/basic-tkinter-1f16</link>
      <guid>https://dev.to/saeedulkudry/basic-tkinter-1f16</guid>
      <description>&lt;p&gt;Many programming languages comes with a GUI library as part of the SDK for developers to enjoy working within the room. It is possible to go for third party library that has the required components which may not be available in the actual SDK.&lt;/p&gt;

&lt;p&gt;Tkinter comes in python as a framework built into the python standard libraries (you don't need to look for it outside). Python has many GUI frameworks such as WxPython, PysimpleGUI, Remi, PyQt5 Wax, Pyside, ttkbootstrap, etc, as seconds to the Tkinter.&lt;/p&gt;

&lt;p&gt;The Tkinter framework has number of countless visual elements rendered by an active machine, so that the code looks as if the code was developed for the machine. Tkinter is cross-flatform, this means the same code works on different devices, Windows, Linux and MacOs.&lt;br&gt;
Python has the following elements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/saeedulkudry/tkinter-label-5cfi"&gt;Lable&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Button&lt;/li&gt;
&lt;li&gt;Entry&lt;/li&gt;
&lt;li&gt;Text&lt;/li&gt;
&lt;li&gt;Frame&lt;/li&gt;
&lt;li&gt;Toplevel&lt;/li&gt;
&lt;li&gt;Canvas&lt;/li&gt;
&lt;li&gt;Menubutton&lt;/li&gt;
&lt;li&gt;Message&lt;/li&gt;
&lt;li&gt;Radiobutton&lt;/li&gt;
&lt;li&gt;PanedWindow&lt;/li&gt;
&lt;li&gt;Spinbox&lt;/li&gt;
&lt;li&gt;MessageBox&lt;/li&gt;
&lt;li&gt;Scale&lt;/li&gt;
&lt;li&gt;Scrollbar&lt;/li&gt;
&lt;li&gt;Checkbutton&lt;/li&gt;
&lt;li&gt;Menu&lt;/li&gt;
&lt;li&gt;LabelFrame&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Tkinter In Action
&lt;/h2&gt;

&lt;p&gt;Before using tkinter library one must import it into .py file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from tkinter import *
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this ensure all the classes and methods are loaded.&lt;br&gt;
The asterisk (*) tells the engine to import everything inside the class instead of accessing them through dot notation.&lt;/p&gt;

&lt;p&gt;Now it is time to instantiate the tkinter class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;window = Tk()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can access all the methods under Tk class using the reference variable  window.&lt;/p&gt;

&lt;p&gt;To make the app run we must call mainloop() method at the very end of every tkinter program.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;window.mainloop()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will output the following result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg1fmwur7uw9rc2i8lfid.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg1fmwur7uw9rc2i8lfid.PNG" alt="Tkinter window" width="213" height="242"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Thank you for reading.&lt;/em&gt;&lt;br&gt;
For further reading click on any component at the very top of the page.&lt;br&gt;
Written by &lt;a href="//www.saeed.dcrowdalpha.com"&gt;Saeed Adam&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
    </item>
  </channel>
</rss>
