0% found this document useful (0 votes)
7 views5 pages

Python Tkinter and MySQL Programming Tasks

The document contains a series of programming questions focused on creating GUI applications using tkinter and performing database operations with MySQL in Python. Each question includes tasks such as creating windows with buttons, labels, and checkboxes, as well as connecting to a MySQL server to perform CRUD operations. Additionally, it covers image processing tasks using libraries like OpenCV and Pillow.

Uploaded by

ksr2024java
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views5 pages

Python Tkinter and MySQL Programming Tasks

The document contains a series of programming questions focused on creating GUI applications using tkinter and performing database operations with MySQL in Python. Each question includes tasks such as creating windows with buttons, labels, and checkboxes, as well as connecting to a MySQL server to perform CRUD operations. Additionally, it covers image processing tasks using libraries like OpenCV and Pillow.

Uploaded by

ksr2024java
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Ǫuestion 1

a) Write a program by using tkinter to create a window with pack


method which will display two checkboxes one with the text 'Music' and
another with the text 'Video'.
b) Write a program in python which will establish a connection with
MySǪL server and pythonDB3 database. It will insert a row into the
employee table. On successful insertion it will display '1 record
inserted!'.

Ǫuestion 2
a) Write a program by using tkinter to create a window (height=300,
width=300) which will have a button with the text 'hello'. If we press that
button then it will display a message box with the title 'Hello Python' and
with the message 'Hello World'.
b) Write a program in python which will establish a connection with
MySǪL server and pythonDB3 database. It will display name, id, salary of
all the employees whose name starts with 'J' followed by any number of
characters.

Ǫuestion 3
a) Write a program by using tkinter to create a window with pack
method which will have a ListBox with the following items: Python, Perl, C,
PHP, JSP, Ruby.
b) Write a program by using tkinter to create a window with pack
method which will have a label 'User Name' and textfield. Next line there
will be another label 'Password' and a textfield. Next line there will be two
buttons 'Login' and 'Cancel'. After typing the User Name and Password if we
click on the Login Button then it will check if UserName = 'admin' and
Password = 'adminadmin'. If it matches then display 'Login is Successful'
otherwise display 'Login Failed! Invalid UserName or Password.'

Ǫuestion 4
a) Write a program by using tkinter to create a window with pack
method which will display a label with the text 'User Name:' on the left
side and a textfield (Entry) on the right-hand side.
b) Install opencv-python and numpy libraries using pip. Then write a
python script to read an image ([Link]) using cv2, perform auto canny
edge detection on the image and display it.

Ǫuestion 5
a) Write a program by using tkinter to create a window with pack
method which will have two frames. The first frame will have three buttons
'Red', 'Brown', and 'Blue'. The second frame will be placed at the bottom
which will have a single button 'Black'.
b) Write a program in python which will establish a connection with
MySǪL server and pythonDB3 database. It will perform join operation on
employee and dept tables based on common column dept_id. Retrieve id,
name, salary from employee and dept_id, dept_name from dept.

Ǫuestion 6
a) Write a program by using tkinter to create a window with pack
method which will have a label 'UserName:' and a textfield. Next line
another label 'Password:' and a textfield. Next line two buttons 'Login' and
'Cancel'. On clicking 'Login', show message boxes displaying the entered
username and password.
b) Write a program in python which will establish a connection with
MySǪL server and create a new database called pythonDB3. Then display
all database names present in MySǪL server.

Ǫuestion 7
a) Write a program by using tkinter to create a window with pack
method which will have a button 'Hello'. If clicked, the background color of
the window becomes blue.
b) Write a program in python which will establish a connection with
MySǪL server and pythonDB3 database. Then create Employee table with
columns (name VARCHAR(20), id INT PRIMARY KEY, salary FLOAT, dept_id
INT). Display 'Table is created successfully' on success.

Ǫuestion 8
a) Write a program by using tkinter to create a window (height=400,
width=400) which will have 3 buttons 'Red', 'Green', and 'Blue'. If clicked,
the window's background changes to the respective color.
b) Write a program in python which will establish a connection with
MySǪL server and pythonDB3 database. Delete a row from Employee
table where id = 110.

Ǫuestion G
a) Write a program by using tkinter to create a window with pack
method having a 'Close' button. On clicking, the window will close.
b) Write a program in python which will establish a connection with
MySǪL server and pythonDB3 database. Insert 3 rows at a time into
Employee table.
Ǫuestion 10
a) Write a program in python to connect with MySǪL server and
pythonDB3 database. Alter Employee table and add a column
branch_name VARCHAR(20). Display 'Table Altered Successfully' on
success.
b) Write a python script to create a socket. Display 'Socket is created
successfully'. Connect with host [Link] on port 80. Display
'Socket successfully connected to Google' on success.

Ǫuestion 11
a) Write a program in python which connects with MySǪL server
and pythonDB3 database. Update Employee table setting
name='alex' where id=110.
b) Install opencv-python using pip. Write a script to
read an image (test_image_house.jpg), resize it, and
display it as scaled_img.jpg.

Ǫuestion 12
a) Write a program in python which connects with MySǪL server
and pythonDB3 database and retrieves all rows from Employee
table.
b) Write a python script to create a socket and display socket info.
Then retrieve and display IP address of any host using socket.

Ǫuestion 13
a) Install opencv-python using pip. Write a script to open image
([Link]) in gray color. When any key is pressed, the image closes.
Also install pillow, open ([Link]), crop and display part of the image.
b) Write a tkinter program to create a window (height=100, width=100).

Ǫuestion 14
a) Install pillow using pip. Write a python script to open ([Link]),
display size and format, rotate it 45° and display it.
b) Install opencv-python using pip. Read image ([Link]), rotate it
180°, display and close on key press.

Ǫuestion 15
a) Install pillow using pip. Write a python script to open ([Link]),
create thumbnail (100x100) and display it. Also convert image to gray and
display it.
b) Install pillow using pip. Create a new red image of size 200x200 and
display it.
Ǫuestion 16
a) Install pillow using pip. Write a python script to open ([Link]),
create a 100x100 thumbnail and display it. Convert the same image to gray
and display it.
b) Write a python script to create a client socket, connect to [Link]
on port 40674, receive message from server, and display 'Thank You'
message.

Ǫuestion 17
a) Write a tkinter program with pack method having a ListBox: Python,
Perl, C, PHP, JSP, Ruby.
b) Write a python script to create a socket. Display 'Socket
successfully created'. Bind socket to port 40674, listen for clients, and
send 'Thank You' message on connection.

You might also like