Found 26504 Articles for Server Side Programming

Converting Tkinter program to exe file

Dev Prakash Sharma
Updated on 03-May-2021 08:44:24

22K+ Views

Let us suppose that we want to create a standalone app (executable application) using tkinter. We can convert any tkinter application to an exe compatible file format using the PyInstaller package in Python.To work with pyinstaller, first install the package in the environment by using the following command, pip install pyinstallerOnce installed, we can follow the steps to convert a Python Script File (contains a Tkinter application file) to an Executable file.Install pyinstaller using pip install pyinstaller in Windows operating system. Now, type pyinstaller --onefile -w filename and press Enter.Now, check the location of the file (script file) and you will ... Read More

Change the color upon hovering over Button in Tkinter

Dev Prakash Sharma
Updated on 03-May-2021 08:40:58

5K+ Views

Let us suppose that we are creating an application in which we want to change the color of the Button widget while we hover upon it. We can have the hovering property by defining the Event Callbacks.To change the color of the Button while hovering on it, we have to bind the and events. For each event, we will configure the button property such as background color, foreground color, etc.Example#Import required libraries from tkinter import * #Create an instance of tkinter frame win= Tk() #Define the geometry of the window win.geometry("750x250") #Define functions def on_enter(e):    button.config(background='OrangeRed3', foreground= ... Read More

Binding mouse double click in Tkinter

Dev Prakash Sharma
Updated on 03-May-2021 07:44:15

3K+ Views

Let us suppose that for a particular application, we want to bind the mouse double-click so that it performs some event or operation. We can use the bind(‘’, handler) or bind(‘’, handler) methods to bind the mouse Left or Right Buttons with a handler or a callback function.ExampleIn this example, we will create an application that contains a button. When we double click the button, it will open a popup window.#Import required libraries from tkinter import * from tkinter import ttk #Create an instance of tkinter frame win= Tk() #Define the geometry of the window win.geometry("750x250") #Define a function def ... Read More

Automatically close window after a certain time in Tkinter

Dev Prakash Sharma
Updated on 30-Apr-2021 21:26:25

7K+ Views

In order to close a Tkinter application, we generally refer to close the parent window using the destroy() method. To close the Tkinter window automatically after a certain time limit, we have to use the after(time in ms, callback) method by specifying the time and the callback function which needs to be run after a certain time limit.Example#Import the required Libraries from tkinter import * from tkinter import ttk #Create an instance of tkinter frame win = Tk() #Set the geometry of tkinter frame win.geometry("750x270") #Initialize a Label widget Label(win, text= "This window will get closed after ... Read More

URLSearchParams values & keys() in Node

Mayank Agarwal
Updated on 28-Apr-2021 07:31:36

426 Views

Introduction to values()This function returns an iterator that allows us to iterate all over the values that are present in that object. It basically gives us a tool to select or iterate the values and then perform functions on them.SyntaxURLSearchParams.values();It will return an ES6 type iterator with the name-value pair over all the values.Example// Defining the parameters as a constant var params = new URLSearchParams( 'key1=value1&key2=value2&key3=value3'); // Iterating over the values of params for(var value of params.values()) {    console.log(value); }Outputvalue1 value2 value3Example// Defining the URL as a constant const params = new URLSearchParams('name=John&age=21'); // Iterating over the ... Read More

URLSearchParams.set & append() in Node

Mayank Agarwal
Updated on 28-Apr-2021 07:16:38

778 Views

Introduction to set()This function can be used to set the value of the name argument passed with the new value passed. If multiple name-value pair exists, only one name-value pair will be set and all the remaining pairs will be removed as shown in the example below.SyntaxURLSearchParams.set(name, value);ParametersThe inputs are name and a value. The name is used to find the value that needs to be updated with the new value given in the argument. New value is not set if the name paramter does not exist in the URL.Example// Defining the URL as a constant const params = new ... Read More

URLSearchParams.has & delete() in Node

Mayank Agarwal
Updated on 28-Apr-2021 07:13:08

228 Views

Introduction to has()This function returns true or false based upon the query argument. The function will return true if name-value pair exists for the argument.Syntaxvar bool = URLSearchParams.has(name);It will return TRUE if name is present, else FALSE.ParametersThe input parameter is a name that needs to be searched in the URL.Example // Defining the URL as a constant const myURL = new URL(    'https://example.org/?firstName=John'); // Printing whether the argument exists or not console.log(myURL.searchParams.get('firstName'));OutputtrueExample// Defining the URL as a constant const myURL = new URL(    'https://example.org/?firstName=John'); // Printing whether the argument exists or not console.log(myURL.searchParams.get('lastName'));OutputfalseIntroduction to delete()It will delete/remove ... Read More

URLSearchParams entries & forEach in Node

Mayank Agarwal
Updated on 28-Apr-2021 07:05:54

466 Views

Introduction to entries() −This function returns an iterator that allows us to iterate all over the entry set that are present in the object. It basically gives us a tool to iterate over the complete entry set of the param object.SyntaxURLSearchParams.entries();It will return an ES6 type iterator with all the name-value pair values.Example// Defining the parameters as a variable var params = new URLSearchParams('key1=value1&key2=value2&key3=value3'); // Iterating over the values of params for(var entry of params.entries()) {    console.log(entry[0] + ' -> ' + entry[1]); }Outputkey1 -> value1 key2 -> value2 key3 -> value3Example// Defining the URL as a constant ... Read More

Sync vs Async vs Async/Await in fs-extra - NodeJS

Mayank Agarwal
Updated on 28-Apr-2021 07:00:22

404 Views

Introduction to fs-extraBefore proceeding with fs-extra, one must have a basic knowledge of the fs file system. The fs-extra is an extension of the fs file system and has more methods than it. It adds some file method systems that are not there in the naive fs modules. Fs-extra adds the promise support to the fs methods and therefore better than fs.Installationnpm install fs-extraSyntaxfs-extra is a replacement for the native fs file system. All methods that are in fs are attached to fs-extra as well. Therefore, you don't need to include fs again.const fs = require('fs-extra');Most methods provided by fs-extra ... Read More

Sync Copy in fs-extra using NodeJS

Mayank Agarwal
Updated on 28-Apr-2021 06:58:19

2K+ Views

Introduction to Sync copyThis method copies files or directories from one location to another location in a sync process. The directory can have sub-directories and files.SyntaxcopySync(src, dest[, options])Parameterssrc – This is a string paramter which will hold the source location of the file or directory that needs to be copies. If the location is a directory, it will copy everything inside of the directory instead of whole directory.dest – This will hold the destination location where the files/directories will be copies. If src is a files, dest cannot be a directory.Optionsoverwrite – If set to true, existing files or directories ... Read More

Advertisements