Found 26504 Articles for Server Side Programming

Setting Background color for Tkinter in Python

Dev Prakash Sharma
Updated on 26-Mar-2021 10:20:36

3K+ Views

We can customize the tkinter widgets using the tkinter.ttk module. Tkinter.ttk module is used for styling the tkinter widgets such as setting the background color, foreground color, activating the buttons, adding images to labels, justifying the height and width of widgets, etc.In order to add a background color in tkinter widgets, we can specify the background property in the widget.ExampleIn the following example, we will create a button that will change the background of the text label.#Import the tkinter library from tkinter import * from tkinter.ttk import * #Create an instance of tkinter frame win = Tk() #Set the ... Read More

What is the difference between root.destroy() and root.quit() in Tkinter(Python)?

Dev Prakash Sharma
Updated on 26-Mar-2021 10:19:20

6K+ Views

When we invoke the destroy() method with the tkinter window object, it terminates the mainloop process and destroys all the widgets inside the window. Tkinter destroy() method is mainly used to kill and terminate the interpreter running in the background.However, quit() method can be invoked in order to stop the process after the mainloop() function. We can demonstrate the functionalities of both methods by creating a button Object.Example#Import the required libraries from tkinter import * #Create an instance of tkinter frame win= Tk() #Set the geometry of frame win.geometry("650x450") #Define a function for Button Object def quit_win(): ... Read More

What is the difference between the widgets of tkinter and tkinter.ttk in Python?

Dev Prakash Sharma
Updated on 26-Mar-2021 10:18:53

7K+ Views

tkinter.ttk is a module that is used to style the tkinter widgets. Just like CSS is used to style an HTML element, we use tkinter.ttk to style tkinter widgets.Here are the major differences between tkinter widget and tkinter.ttk −Tkinter widgets are used to add Buttons, Labels, Text, ScrollBar, etc., however, tkinter.ttk supports a variety of widgets as compared to tkinter widgets.Tkinter.ttk doesn't support Place, Pack() and Grid(), thus it is recommended to use tkinter widget with ttk.Ttk has many features and configurations that extend the functionality of a native application and make it look more modern.Tkinter widget is a native ... Read More

C program to print name inside heart pattern using for loop.

Bhanu Priya
Updated on 26-Mar-2021 08:03:25

3K+ Views

ProblemWrite a program to print heart shaped pattern with the name in centre using for loop.SolutionThe user has to enter the name that should be printed in centre along with the number of rows the stars has to be print.AlgorithmRefer an algorithm given below to print the name in heart pattern by using for loop.Step 1 − Declare variables.Step 2 − Read a name at runtime that should be printed on centre.Step 3 − Read number of rows.Step 4 − Find the length of name.Step 5 − Print upper part of the heart.Step 6 − Print lower part of the ... Read More

C program to store the car information using dynamic linked list.

Bhanu Priya
Updated on 26-Mar-2021 07:57:51

4K+ Views

Linked lists use dynamic memory allocation i.e. they grow and shrink accordingly. It is collection of nodes.Node has two parts which are as follows −DataLinkTypes of Linked ListsThe types of linked lists in C programming language are as follows −Single / Singly linked listsDouble / Doubly linked listsCircular single linked listCircular double linked listAlgorithmRefer an algorithm given below for storing the car information by using the dynamic linked list.Step 1 − Declare structure variables.Step 2 − Declare Function definition to display.Step 3 − Allocate dynamic memory allocation to variable.Step 4 − Use do while loop to enter the car information.Step ... Read More

C program to find the area of circle and cylinder using structures.

Bhanu Priya
Updated on 26-Mar-2021 07:54:54

2K+ Views

In C programming language, we can find the area of circle, area and volume of cylinder with the help of structures.The logic used to find area of circle is as follows −s.areacircle = (float)pi*s.radius*s.radius;The logic used to find area of cylinder is as follows −s.areacylinder = (float)2*pi*s.radius*s.line + 2 * s.areacircle;The logic used to find the volume of cylinder is −s.volumecylinder = s.areacircle*s.line;AlgorithmRefer an algorithm given below to find the area of circle and cylinder along with other parameters by using structures.Step 1 − Declare structure members.Step 2 − Declare and initialize the input variables.Step 3 − Enter length and ... Read More

What is an anagram in C language?

Bhanu Priya
Updated on 26-Mar-2021 07:52:46

4K+ Views

Anagram strings are nothing but, all the characters that occur for the same number of times in another string, which we call as anagrams.A user enters two strings. We need to count how many times each letter ('a' to 'z') appears in them and then, compare their corresponding counts. The frequency of an alphabet in a string is how many times it appears in it.If two strings have same count of the frequency of particular alphabet then, we can say those two strings are anagrams.Example 1String 1 − abcdString 2 − bdacThese two strings have same letters which appear once. ... Read More

C Program find nCr and nPr.

Bhanu Priya
Updated on 26-Mar-2021 07:50:25

17K+ Views

In C programming language, nCr is referred as the combination. nCr is the selection of r objects from a set of n objects, where the order of objects does not matter.nPr is referred as the permutation. nPr is arrangement of 'r' objects from a set of 'n' objects, which should be in an order or sequence.Permutations and combinations formulasThe formulas to find the permutation and combination of given numbers in C language are given below −nCr = n!/(r!*(n-r)!)nPr = n!/(n-r)!.The logic used to find nCr is as follows −result = factorial(n)/(factorial(r)*factorial(n-r));The logic used to find nPr is as follows −result ... Read More

C program to perform intersection operation on two arrays

Bhanu Priya
Updated on 26-Mar-2021 07:55:31

9K+ Views

Intersection operationIf array 1 = { 1,2,3,4,6}  Array 2 = {1,2,5,6,7}Then, intersection of array1 and array 2 isArray1 ^ array 2 = {1,2,3,4,6} ^ {1,2,5,6,7}         = {1,2,6}Set of common elements is called an intersection.The logic for intersection is as follows −k=0; for(i=0;i

C program to perform union operation on two arrays

Bhanu Priya
Updated on 26-Mar-2021 07:52:41

15K+ Views

A union is a special data type available in C programming language that allows to store different data types in the same memory location. Unions provide an efficient way of using the same memory location for multiple-purpose.Union operationIf array 1 = { 1,2,3,4,6}    Array 2 = {1,2,5,6,7}Then, union of array1 and array 2 isArray1 U array 2 = {1,2,3,4,6} U {1,2,5,6,7}                              = {1,2,3,4,5,6,7}Set of all elements without repetition is called union.The logic for union is as follows −for(i=0;i

Advertisements