Change the Color of Tab Header in TTK Notebook Tkinter

Dev Prakash Sharma
Updated on 08-Jun-2021 09:40:58

7K+ Views

Tabs are very useful for a multipurpose GUI application. It helps to isolate the several tasks or processes within the application in the form of tabs. Tabs are very useful for processing multiple tasks at a time. With the help of Tkinter Notebook widget, we can create Tabs in our tkinter application.To configure the property or style of the tabs, we must have to use a ttk themed widget. The ttk themed widget helps to style any widget present in the application. To configure the background color of the tab, you can use ttk 'default' theme along with passing 'TNotebook.Tab' ... Read More

Overlap Widgets in Frames Using Python Tkinter

Dev Prakash Sharma
Updated on 08-Jun-2021 09:39:47

5K+ Views

There are three general ways through which we can align and position a particular widget in a Tkinter application. Let us suppose that we want to overlap two or more widgets or frames one on another, then we can use place() geometry manager. What place() geometry manager does is that it lines up the widget in rows and columns of a grid. We can certainly overlap the widget by providing the same coordinate in each.Example# Import the required libraries from tkinter import * from tkinter import ttk # Create an instance of tkinter frame win = Tk() # ... Read More

Edit Style of a Heading in Treeview using Python ttk

Dev Prakash Sharma
Updated on 08-Jun-2021 09:37:56

10K+ Views

Python Treeview widget is introduced for creating a Table look-like GUI in application. It includes many inbuilt features and functions which can be used to configure the properties. However, to configure the style of a tkinter widget, we generally refer to use ttk themed widget. This allows you to edit the style such as background color, foreground color, and other properties of the treeview widget as well.ExampleIn this example, we will create an instance of the ttk style widget and then configure the style of heading by passing 'Treeview.Heading' as the style parameter.# Import the required libraries from tkinter import ... Read More

Display LaTeX in Real-Time in a Text Box in Tkinter

Dev Prakash Sharma
Updated on 08-Jun-2021 09:36:26

3K+ Views

Python Matplotlib library is useful in applications where we need to visualize the data points and draw graphs and plots to analyze the data. Let us suppose that we want to create a tkinter application where we can process LaTex syntax.LaTex syntax is used for preparing scientific documentation such as, formulae, scientific notations, mathematical characters, and punctuations. To prepare the application, we are required to use matplotlib and TkAgg (backend API for Matplotlib in Tkinter) modules. The following steps are used to structure the application functions and widgets, Import the required libraries such as Matplotlib, Tkinter, Ttk (for styling the ... Read More

Show Webcam in Tkinter Window

Dev Prakash Sharma
Updated on 08-Jun-2021 09:33:33

8K+ Views

Python libraries are independent and thus they all can be used for different purposes while building a particular featured application. In this example, we will build an application using OpenCV and Tkinter library. OpenCV is a Python library that is used to work with Computer Vision and other artificial artifacts. Using the OpenCV module, we have to show the webcam in a tkinter window.To create the application, you are required to install open-cv in your local machine and make sure that Python Pillow package is pre-installed. You can install these packages by typing the following commands, pip install open-cv pip ... Read More

Vary Shape's Alpha with Tkinter

Dev Prakash Sharma
Updated on 08-Jun-2021 09:31:31

2K+ Views

The Canvas widget is one of the multilateral widgets in tkinter library which is used to provide graphics for any application. It can be used to draw shapes, images, animating objects or any complex visuals. The alpha property of the shape defines that if we give the alpha value to any shape, then it must have some transparency behaviour with respect to its parent window.To define the alpha property, we have to assume that every shape have some colors in it and whenever we provide an alpha value to a shape, then it must be converted into an Image. The ... Read More

Creating a Table Look-a-like Using Tkinter

Dev Prakash Sharma
Updated on 08-Jun-2021 09:27:16

4K+ Views

A table contains data items in the form of rows and columns. Consider a case of having a table GUI in an application where we can manipulate the data using other Python libraries such as Numpy, Pandas, Matplotlib, etc. Tkinter provides TreeView widget which enable the user to draw the table and insert the data into it. The TreeView widget can be constructed by defining the Treeview(parent, column, **options) constructor.Example# Import the required libraries from tkinter import * from tkinter import ttk # Create an instance of tkinter frame win = Tk() # Set the size of the ... Read More

Change Menu Background Color of Tkinter's OptionMenu Widget

Dev Prakash Sharma
Updated on 08-Jun-2021 09:24:57

1K+ Views

Consider a scenario where we need something to display a menu with some choices in the form of a dropdown list. To achieve this particular feature, Tkinter provides an OptionMenu widget which consists of features to add choices and a list of items in it. We can set up the default behavior of the OptionMenu widget by configuring its property such as background color, width, height, foreground color, etc.Example# Import the required libraries from tkinter import * from PIL import Image, ImageTk # Create an instance of tkinter frame win = Tk() # Set the size of the ... Read More

Maximum Power Transfer Theorem

Manish Kumar Saini
Updated on 08-Jun-2021 09:00:03

855 Views

The maximum power theorem (MPT) is used to find the value of load resistance for which there would be maximum amount of power transfer from the source to load.Statement of MPTA resistive load that is connected to a DC source, receives maximum power when the load resistance is equal to the internal resistance of the source as seen from the load terminals.Explanation of MPTConsider the following circuit diagram to determine the value of RL such that it receives maximum power from the DC source.The load current is, $$I=\frac{V_{Th}}{R_{Th}+R_{L}}$$Thus, the power delivered to the resistive load is, $$P_{L}=I^{2}R_{L}=(\frac{V_{Th}}{R_{Th}+R_{L}})^{2}R_{L}$$As we know, the ... Read More

Make Tkinter Canvas Rectangle Transparent

Dev Prakash Sharma
Updated on 08-Jun-2021 07:28:19

11K+ Views

The canvas widget is one of the most versatile widgets in Tkinter Library. Generally, it is used to draw shapes, animate objects, and create complex graphics in any application. To create shapes like Rectangle, we use the create_rectangle(x, y, x+ width, y+ height, **options) method. We can configure the item on the canvas by adding properties such as width, height, fill and bg, border width, etc.The alpha property in canvas defines the transparency of the canvas item. However, the property is not available in the Tkinter library; thus, we must define a function to provide the transparency attribute in shape. ... Read More

Advertisements