Professional Documents
Culture Documents
import re
import mysql.connector as ms
import base64
import sys
import subprocess
import os
import io
import mysql.connector
import base64
#import tkinter.messagebox
def __init__(self):
super().__init__()
self.title("Main Form")
self.geometry("800x500")
self.reportno=0
self.main_frame = tk.Frame(self)
self.main_frame.pack(fill=tk.BOTH, expand=True)
self.x_scrollbar.config(command=self.canvas.xview)
self.canvas.config(yscrollcommand=self.y_scrollbar.set)
self.y_scrollbar.config(command=self.canvas.yview)
self.x_scrollbar.pack(side=tk.BOTTOM, fill=tk.X)
self.y_scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
# Bind the container frame resize to configure the canvas scroll region
self.container.bind("<Configure>", self.configure_canvas_scroll_region)
def initUI(self):
menubar = tk.Menu(self)
menu1.add_command(label="Student Registration",
command=self.create_personal_info_frame)
menu1.add_separator()
menu1.add_command(label="Exit",command=self.quit_app)
menu2.add_separator()
menu2.add_command(label="Exit",command=self.quit_app)
self.config(menu=menubar)
def quit_app(self):
sys.exit()
return frame
self.canvas.configure(scrollregion=self.canvas.bbox("all"))
# write code here for giving warning message , if the browsed image size is too lang than Mysql-
blob datatype size
class studentform2(MainApplicationForm):
def __init__(self):
super().__init__()
print("Constructor is called...")
#self.c_id = tk.StringVar()
def search_form(self):
print("hi ")
class studentform1(studentform2):
def __init__(self):
super().__init__()
#self.reportno=0
def upload_photo(self):
if file_path:
self.image_data = file.read()
warning_message = "Warning: Selected image size is too large for MySQL BLOB datatype."
messagebox.showinfo("Flight", str(warning_message))
#self.show_warning(warning_message)
return
image = Image.open(io.BytesIO(self.image_data))
self.photo = ImageTk.PhotoImage(image)
self.photo_label.config(image=self.photo)
self.photo_label.image = self.photo
else:
self.photo_label.config(image="")
self.photo_label.image = None
def create_personal_info_frame(self):
print("hi")
if __name__ == "__main__":
app = studentform1()
app.mainloop()