What is a Filter?A filter is a frequency selective network, i.e., it allows the transmission of signals of certain frequencies with no attenuation or with very little attenuation and it rejects all other frequency components.What is an Ideal Filter?An ideal filter is a frequency selective network that has very sharp cut-off characteristics, i.e., it transmits the signals of certain specified band of frequencies exactly and totally rejects the signals of frequencies outside this band. Therefore, the phase spectrum of an ideal filter is linear.Ideal Filter CharacteristicsBased on the frequency response characteristics, the ideal filters can be of following types −Ideal ... Read More
Hilbert TransformWhen the phase angles of all the positive frequency spectral components of a signal are shifted by (-90°) and the phase angles of all the negative frequency spectral components are shifted by (+90°), then the resulting function of time is called the Hilbert transform of the signal.The Hilbert transform of a signal$\mathit{x\left(t\right)}$ is obtained by the convolution of $\mathit{x\left(t\right)}$ and (1/πt), i.e., , $$\mathrm{\mathit{\hat{x}\left(t\right)=x\left(t\right)*\left ( \frac{\mathrm{1}}{\mathit{\pi t}} \right )}}$$Properties of Hilbert TransformThe statement and proofs of the properties of the Hilbert transform are given as follows −Property 1The Hilbert transform does not change the domain of a signal.ProofLet a ... Read More
If the canvas looks distorted, then try to change the height and width −The default height and width of the canvas in HTML5 is of 2/1 ratio −width = 300 height = 150ExampleLet us see an example − #mycanvas{border:1px solid red;} Output
The HTML5 tag is used to draw graphics, animations, etc. using scripting. It is a new tag introduced in HTML5. Use the lineTo() method to draw lines using HTML5 canvas.You can try to run the following code to learn how to draw lines using HTML5 Canvas Example HTML5 Canvas Tag var c = document.getElementById('newCanvas'); var ctx = c.getContext('2d'); // Drawing lines ctx.beginPath(); ctx.moveTo(30, 30); ctx.lineTo(180, 100); ctx.moveTo(30, 10); ctx.lineTo(260, 100); ctx.stroke(); Output
You can try to run the following code to draw an oval in HTML5 canvas −Example // canvas var c = document.getElementById('newCanvas'); var context = c.getContext('2d'); var cX = 0; var cY = 0; var radius = 40; context.save(); context.translate(c.width / 2, c.height / 2); context.scale(2, 1); context.beginPath(); context.arc(cX, cY, radius, 0, 2 * Math.PI, false); context.restore(); context.fillStyle = '#000000'; context.fill(); context.lineWidth = 2; context.strokeStyle = 'yellow'; context.stroke(); Output
The Text widget accepts multiline user input, where you can type text and perform operations like copying, pasting, and deleting. There are certain ways to disable the shortcuts for various operations on a Text widget.In order to disable copy, paste and backspace in a Text widget, you’ve to bind the event with an event handler and return break using lambda keyword in python. The following example demonstrates how it works.Example# Import the required library from tkinter import * # Create an instance of tkinter frame or widget win=Tk() win.geometry("700x350") # Create a text widget text=Text(win, font="Calibri, 14") text.pack(fill= ... Read More
If you want to create a dropdown list of items and enable the items of list to be selected by the user, then you can use the Combobox widget. The Combobox widget allows you to create a dropdown list in which the list of items can be selected instantly. However, if you want to get the index of selected items in the combobox widget, then you can use the get() method. The get() method returns an integer of the selected item known as the index of the item.ExampleLet’s take an example to see how it works. In this example, we ... Read More
There are various methods and built-in functions available with the messagebox library in tkinter. Let's assume you want to display a messagebox and take some input from the user in an Entry widget. In this case, you can use the askstring library from simpledialog. The askstring library creates a window that takes two arguments, the title of the window, and the input title before the Entry widget. Let's take an example to understand how it works.Example# Import the required library from tkinter import * from tkinter.simpledialog import askstring from tkinter.messagebox import showinfo # Create an instance of tkinter frame ... Read More
If you want to display a list of items that contains some columns in it, then you can use the Treeview widget in Tkinter. The Treeview widget allows the user to add a large number of lists along with the properties that can be customized instantly.If you want to attach a vertical scrollbar to the list of items in a Treeview widget, then you can define a constructor of Scrollbar and configure it by adding the command to it. Let’s take an example and see how it works.Example# Import the required libraries from tkinter import * from tkinter import ttk ... Read More
The Treeview widget is used to display a list of items with more than one feature in the form of columns. By default, the listed items in a Treeview widget can be selected multiple times, however you can disable this feature by using selectmode="browse" in the Treeview widget constructor. The Treeview widget can be implemented by using the Treeview(root, column, **options) constructor.ExampleThe following example demonstrates how to disable multiselection in a Treeview widget.# Import the required libraries from tkinter import * from tkinter import ttk # Create an instance of tkinter frame win=Tk() # Set the size of ... Read More