-
Notifications
You must be signed in to change notification settings - Fork 0
/
farmer.py
173 lines (144 loc) · 5.18 KB
/
farmer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# GUI module generated by PAGE version 4.26
# in conjunction with Tcl version 8.6
# Oct 25, 2019 02:18:34 PM IST platform: Linux
import os
import sys
from subprocess import call
import MySQLdb
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
from tkinter import messagebox
try:
import ttk
py3 = False
except ImportError:
import tkinter.ttk as ttk
py3 = True
import farmer_support
def click_register():
call(['python3', 'register.py'])
def click_business():
call(['python3', 'business.py'])
def click_crops():
call(['python3', 'crops.py'])
def click_loan():
call(['python3', 'loan.py'])
def click_queries():
call(['python3', 'queries.py'])
def click_delete():
call(['python3', 'delete.py'])
def vp_start_gui():
'''Starting point when module is the main routine.'''
global val, w, root
root = tk.Tk()
top = Farmer (root)
farmer_support.init(root, top)
root.mainloop()
w = None
def create_Farmer(root, *args, **kwargs):
'''Starting point when module is imported by another program.'''
global w, w_win, rt
rt = root
w = tk.Toplevel (root)
top = Farmer (w)
farmer_support.init(w, top, *args, **kwargs)
return (w, top)
def destroy_Farmer():
global w
w.destroy()
w = None
class Farmer:
#def
def __init__(self, top=None):
try:
self.db_far = MySQLdb.connect("localhost","shivam","","FARMER")
self.cursor_far = self.db_far.cursor()
except:
print('Error')
_bgcolor = '#d9d9d9' # X11 color: 'gray85'
_fgcolor = '#000000' # X11 color: 'black'
_compcolor = '#d9d9d9' # X11 color: 'gray85'
_ana1color = '#d9d9d9' # X11 color: 'gray85'
_ana2color = '#ececec' # Closest X11 color: 'gray92'
font10 = "-family gothic -size 15 -weight normal -slant roman " \
"-underline 0 -overstrike 0"
top.geometry("725x573+391+117")
top.minsize(1, 1)
top.maxsize(1351, 738)
top.resizable(0, 0)
top.title("Farmer")
top.configure(borderwidth="10")
top.configure(background="#9ed8d6")
self.menubar = tk.Menu(top,font="TkMenuFont",bg=_bgcolor,fg=_fgcolor)
top.configure(menu = self.menubar)
self.f1 = tk.Frame(top)
self.f1.place(relx=0.014, rely=0.017, relheight=0.218, relwidth=0.972)
self.f1.configure(relief='groove')
self.f1.configure(borderwidth="2")
self.f1.configure(relief="groove")
self.f1.configure(background="#d6d891")
self.title = tk.Label(self.f1)
self.title.place(relx=0.241, rely=0.16, height=75, width=379)
self.title.configure(font=font10)
self.title.configure(text='''Welcome to Farmer Management System''')
self.f2 = tk.Frame(top)
self.f2.place(relx=0.014, rely=0.227, relheight=0.759, relwidth=0.972)
self.f2.configure(relief='groove')
self.f2.configure(borderwidth="2")
self.f2.configure(relief="groove")
self.f2.configure(background="#b8d8ad")
self.business = tk.Button(self.f2)
self.business.place(relx=0.34, rely=0.207, height=45, width=220)
self.business.configure(activebackground="#7daf64")
self.business.configure(background="#63d882")
self.business.configure(font=font10)
self.business.configure(foreground="#30160f")
self.business.configure(text='''Make Business''')
self.business.configure(command=click_business)
self.register = tk.Button(self.f2)
self.register.place(relx=0.34, rely=0.046, height=45, width=220)
self.register.configure(activebackground="#7daf64")
self.register.configure(background="#63d882")
self.register.configure(font="-family {gothic} -size 15")
self.register.configure(foreground="#30160f")
self.register.configure(text='''Register''')
self.register.configure(command=click_register)
self.crop = tk.Button(self.f2)
self.crop.place(relx=0.34, rely=0.368, height=45, width=220)
self.crop.configure(activebackground="#7daf64")
self.crop.configure(background="#63d882")
self.crop.configure(font="-family {gothic} -size 15")
self.crop.configure(foreground="#30160f")
self.crop.configure(text='''Crop Management''')
self.crop.configure(command=click_crops)
self.loan = tk.Button(self.f2)
self.loan.place(relx=0.34, rely=0.529, height=45, width=220)
self.loan.configure(activebackground="#7daf64")
self.loan.configure(background="#63d882")
self.loan.configure(font="-family {gothic} -size 15")
self.loan.configure(foreground="#30160f")
self.loan.configure(text='''Register for Loan''')
self.loan.configure(command=click_loan)
self.queries = tk.Button(self.f2)
self.queries.place(relx=0.34, rely=0.69, height=45, width=220)
self.queries.configure(activebackground="#7daf64")
self.queries.configure(background="#63d882")
self.queries.configure(font="-family {gothic} -size 15")
self.queries.configure(foreground="#30160f")
self.queries.configure(text='''Queries''')
self.queries.configure(command=click_queries)
self.delete = tk.Button(self.f2)
self.delete.place(relx=0.34, rely=0.851, height=45, width=220)
self.delete.configure(activebackground="#7daf64")
self.delete.configure(background="#63d882")
self.delete.configure(font=font10)
self.delete.configure(foreground="#30160f")
self.delete.configure(text='''Delete''')
self.delete.configure(command=click_delete)
if __name__ == '__main__':
vp_start_gui()