Create an Impressive GUI in Python Using Tkinter

Dev Prakash Sharma
Updated on 22-Dec-2021 08:19:41

1K+ Views

Tkinter is a standard Python GUI library in Python, which gives us an object-oriented interface with Tk GUI Toolkit. It's amazing how quickly one can create some really impressive looking apps. Actions in GUI are usually performed through direct manipulation of graphical elements.We will take a simple "addition" application to show how easy it is to create an impressive GUI in Python using tkinter. GUI is all about widgets and windows and these are available in Tkinter.First, we will import the Tkinter library, then create a window object (class Tk is used to create window object) and create a label ... Read More

Directly Modify a Specific Item in a Tkinter Listbox

Dev Prakash Sharma
Updated on 22-Dec-2021 08:13:47

2K+ Views

Tkinter is a Python-based GUI application development library which is generally used to build useful functional desktop applications. The Listbox widget is another tkinter widget, which is used as a container to display a list of items in the form of a Listbox.To define a list of items in a Listbox widget, you'll need to create a constructor of Listbox(root, width, height, **options). You can insert as many items as you want to display in the listbox.Suppose you want to modify a specific item in a tkinter Listbox, then you can first create a button to select the item from ... Read More

Change Background Color of a Tkinter Canvas Dynamically

Dev Prakash Sharma
Updated on 22-Dec-2021 08:11:43

21K+ Views

The Canvas widget is one of the most useful widgets in Tkinter. It has various functionalities and features to help developers customize the application according to their need. The Canvas widget is used to display the graphics in an application. You can create different types of shapes and draw objects using the Canvas widget.To change the background color of the Canvas widget, you can use the configure() method. Here, you can specify the background color of the Canvas widget which you want to change explicitly.ExampleIn the following example, we have created a canvas widget with a default background color "skyblue", ... Read More

Explicitly Resize Frames in Tkinter

Dev Prakash Sharma
Updated on 22-Dec-2021 08:10:07

8K+ Views

The Frames widget in tkinter is generally used to display widgets in the form of a container. The Frame widget works similar to the default window container. The geometry and size of the frame widget can be configured using various geometry managers available in the tkinter library.Considering the case, if you want to configure the size of the frame explicitly, you can use the pack() geometry manager by specifying the side and padding property. The pack() geometry manager gives proper accessibility to the widget for resizing.ExampleIn the following example, we will create two frames and resize them using the pack() ... Read More

Create Colored Lines Based on Length in Tkinter

Dev Prakash Sharma
Updated on 22-Dec-2021 08:06:11

2K+ Views

Tkinter Canvas widget is one of the versatile widgets which is generally used to draw shapes, arcs, objects, display images or any content. The objects inside the Canvas widget can be modified as well as configured using the configure() method or within the constructor by providing values to the properties.To create lines on a Canvas widget, you can use the create_lines(x0, x1, x2, x3, fill="color", width, **options) constructor. In the constructor, you can assign the values of x0(top), x1(right), x2(bottom) and x3(left) which would decide the length of the lines to be drawn inside the canvas widget.ExampleLet's take an example ... Read More

Change Tkinter Label Text Dynamically Using Label Configure

Dev Prakash Sharma
Updated on 22-Dec-2021 08:04:25

9K+ Views

The Label widget in tkinter is generally used to display text as well as image. Text can be added in a Label widget by using the constructor Label(root, text= "this is my text"). Once the Label widget is defined, you can pack the Label widget using any geometry manager.If you want to configure the Label widget, you can use the configure() property. The configure() method allows you to edit the text as well other properties of the Label widget dynamically.ExampleLet us take an example to understand how we can dynamically change the tkinter label text using the configure() method. In ... Read More

Stop Tkinter Message Widget from Resizing

Dev Prakash Sharma
Updated on 22-Dec-2021 08:01:10

815 Views

Tkinter Message widget is generally used to display text messages in a tkinter window. The Tkinter Message widget can also be configured by adding different properties to it, for example, font-properties, background and foreground color properties, and padding to widen the corners of the box, etc.Let us assume that we want to stop the Message widget from resizing, then we can use the fill=BOTH property in pack geometry manager while packing the Message widget. Let's take an example to demonstrate how it works.Example# Import the required library from tkinter import * # Create an instance of tkinter frame or ... Read More

Where to Place Script Tags in HTML Markup

Sharon Christine
Updated on 22-Dec-2021 07:44:00

1K+ Views

The JavaScript code should be inserted between and tags in HTML. You can place the tags, containing your JavaScript, anywhere within your web page, but it is normally recommended that you should keep it within the  tags.The tag alerts the browser program to start interpreting all the text between these tags as a script.The script tag takes two important attributes −Language − This attribute specifies what scripting language you are using. Typically, its value will be JavaScript. Although recent versions of HTML (and XHTML, its successor) have phased out the use of this attribute.Type − This ... Read More

Horizontally Center a Div in Another Div

Arnab Chakraborty
Updated on 22-Dec-2021 06:36:55

340 Views

Here I have one html form and one css file(style.css).”o-div” is the outer div and “i-div“is the inner div class.Example           center a div                              I am OUTER DIV                       I am INNER DIV,             I am in Center                     OutputI am OUTER DIV I am INNER DIV, I am in CenterStyle.cssbody {    background-color:Gray;    padding:30px; } .o-div {    padding:50px;    background-color:Lime; } .i-div {    background-color:Fuchsia;    max-width:400px;    height:200px;    margin: 0 auto;    text-align:center; }

HTML vs XML

AmitDiwan
Updated on 22-Dec-2021 05:55:25

729 Views

HTMLHTML stands for HyperText Markup Language which is a language used to describe the structure of a web page. It consists of various HTML element which is composed of HTML tags and their content.HTML is a hypertext language so we can create a chain of links of documents. The current version of HTML is HTML5. HTML is static and it can ignore small errors and in it, closing tags are not necessary.Let us see an example of HTML −Example HTML HTML I'm a HTML document. OutputXMLXML stands for eXtensible Markup Language which ... Read More

Advertisements