Python - geometry method in Tkinter

Pradeep Elance
Updated on 15-Mar-2026 17:14:52

9K+ Views

Python's Tkinter library provides the geometry() method to control the size and position of GUI windows. This method is essential for creating properly sized and positioned applications. Syntax window.geometry("widthxheight+x_offset+y_offset") Where: width and height define window dimensions in pixels x_offset and y_offset set position on screen (optional) Basic Window Sizing Here's how to create a window with specific dimensions ? from tkinter import * base = Tk() base.geometry('200x200') stud = Button(base, text='Tutorialspoint', font=('Courier', 14, 'bold')) stud.pack(side=TOP, pady=6) mainloop() This creates a 200x200 pixel window with a button ... Read More

What are the real world usage of CSS with SVG?

Mohit Panchasara
Updated on 15-Mar-2026 17:14:51

204 Views

CSS with SVG provides powerful styling capabilities for scalable vector graphics. SVG (Scalable Vector Graphics) are vector-based images created using mathematical functions rather than pixel grids, making them infinitely scalable without quality loss. When combined with CSS, SVG becomes a versatile tool for creating interactive, animated, and responsive graphics. Syntax /* Target SVG elements directly */ svg element { property: value; } /* Target SVG elements by class */ .svg-class { property: value; } /* Target SVG elements by ID */ #svg-id { ... Read More

Python - Check if two lists have any element in common

Pradeep Elance
Updated on 15-Mar-2026 17:14:34

4K+ Views

When working with Python lists, we often need to check if two lists share any common elements. This is useful for data comparison, finding overlaps, or validating data consistency. Python provides several efficient approaches to solve this problem. Using the 'in' Operator with Loops The most straightforward approach uses nested loops to check each element of the first list against all elements in the second list ? # Sample lists for comparison fruits = ['apple', 'banana', 'orange', 'mango'] colors = ['red', 'yellow', 'orange', 'blue'] numbers = [1, 2, 3, 4, 5] def has_common_elements(list1, list2): ... Read More

Various tricks for :before pseudo elements using position property in CSS

Mohit Panchasara
Updated on 15-Mar-2026 17:14:29

936 Views

The CSS :before pseudo-element allows you to insert content before an HTML element. When combined with the position property, you can precisely control where this content appears relative to its parent element, creating effects like custom icons, tooltips, notification badges, and styled form elements. Syntax selector:before { content: "text or symbol"; position: absolute | relative | fixed | static; top: value; left: value; right: value; bottom: value; } Example 1: Custom ... Read More

html5lib and lxml parsers in Python

Pradeep Elance
Updated on 15-Mar-2026 17:14:10

835 Views

html5lib is a pure-python library for parsing HTML. It is designed to conform to the WHATWG HTML specification, as is implemented by all major web browsers. It can parse almost all the elements of an HTML doc, breaking it down into different tags and pieces which can be filtered out for various use cases. It parses the text the same way as done by the major browsers. It can also tackle broken HTML tags and add some necessary tags to complete the structure. lxml is also a similar parser but driven by XML features than HTML. It has dependency ... Read More

Targeting only Firefox with CSS

Mohit Panchasara
Updated on 15-Mar-2026 17:13:59

5K+ Views

While developing web applications, developers must make them look consistent across all browsers. Some CSS properties are not supported by Firefox but work in other browsers like Chrome, Opera, etc. In such cases, we need to write CSS code that targets only the Firefox browser. In this article, we will learn two different methods to write CSS that targets only Firefox browsers. Syntax /* Method 1: Mozilla-specific CSS Extension */ @-moz-document url-prefix() { /* CSS code for Firefox only */ } /* Method 2: @supports Rule */ @supports(-moz-appearance:none) { ... Read More

Generating hash ids using uuid3() and uuid5() in Python

Pradeep Elance
Updated on 15-Mar-2026 17:13:53

2K+ Views

The universally unique identifier (UUID) is a 128-bit hexadecimal number that guarantees uniqueness within a given namespace. Python's uuid module provides uuid3() and uuid5() functions to generate hash-based UUIDs from a namespace and name string. Syntax uuid.uuid3(namespace, name) uuid.uuid5(namespace, name) Both functions take two parameters: namespace − A UUID object defining the namespace name − A string used to generate the UUID Key Differences Function Hash Algorithm Security Use Case uuid3() MD5 Lower General purpose uuid5() SHA-1 Higher Security-sensitive applications Common ... Read More

Logical Properties in CSS

Mohit Panchasara
Updated on 15-Mar-2026 17:13:36

363 Views

In CSS, logical properties allow developers to define styles based on the logical structure of the web page rather than the physical layout. This means you can apply CSS according to text direction or content flow, making your designs more adaptable to different languages and writing modes. Logical properties are primarily used to set HTML element's margin, padding, and border. They provide different variants of traditional margin, padding, and border properties that adapt to content flow direction. Syntax selector { property-block-start: value; property-inline-end: value; ... Read More

Find frequency of each word in a string in Python

Pradeep Elance
Updated on 15-Mar-2026 17:13:32

11K+ Views

As a part of text analytics, we frequently need to count words and assign weightage to them for processing in various algorithms. In this article, we will explore three different approaches to find the frequency of each word in a given sentence. Using Counter from Collections The Counter class from the collections module provides an elegant way to count word frequencies. It creates a dictionary where keys are words and values are their counts ? from collections import Counter line_text = "Learn and practice and learn to practice" freq = Counter(line_text.split()) print("Word frequencies:", freq) print("Most ... Read More

Facebook Login using Python

Pradeep Elance
Updated on 15-Mar-2026 17:13:15

1K+ Views

We can use the Python package called Selenium to automate web browser interactions. In this article, we will see how to automate Facebook login using Python's Selenium package. Prerequisites Before automating Facebook login, we need to set up Selenium and a web driver. Here are the required steps ? Step 1: Install Selenium Install the Selenium package in your Python environment ? pip install selenium Step 2: Install WebDriver Download ChromeDriver from the official website or install it using webdriver-manager ? pip install webdriver-manager Finding HTML Elements ... Read More

Advertisements