- import tkinter
-
from tkinter import ttk
-
-
window = tkinter.Tk()
-
window.title("Employees Management Form")
-
window.geometry('600x600')
-
window.configure(background="white");
-
-
class EmployeeForm():
-
-
def __init__(self):
-
#labels for the Entries
-
lblName = ttk.Label(window, text="Name").grid(row=0, column=0)
-
lblId = ttk.Label(window, text="Id").grid(row=1, column=0)
-
lblPhone = ttk.Label(window, text="Phone Number").grid(row=2, column=0)
-
lblAge = ttk.Label(window, text="Age").grid(row=3, column=0)
-
#Entries
-
self.name = ttk.Entry(window).grid(row=0, column=1)
-
self.id = ttk.Entry(window).grid(row=1, column=1)
-
self.phone = ttk.Entry(window).grid(row=2, column=1)
-
self.age = ttk.Entry(window).grid(row=3, column=1)
-
#Submit Button
-
self.button = ttk.Button(window, text="Submit", command=self.on_button()).grid(row=4, column=1)
-
-
#when Submit is press the data is sent to Add Empl manually class
-
def on_button(self):
-
employee = AddEmployeeManually(self.name, self.id, self.phone, self.phone)
-
employee.setData()
-
window.mainloop()
-
-
class AddEmployeeManually():
-
def __init__(self, name, id, age, phone):
-
self.name = name
-
self.phone = phone
-
self.age = age
-
self.id = id
-
-
def setData(self):
-
employees = open('Employees.txt', 'a')
-
try:
-
employees.write(self.id)
-
employees.write(self.name)
-
employees.write(self.phone)
-
employees.write(self.age)
-
employees.write('\n')
-
except:
-
print('Error!')
-
-
def main():
-
choice = int(input("Please type: 1 to Add Employee Manually, 2 to Add from file and 3 to Delete Employee: \n"))
-
if choice == 1:
-
chosen = EmployeeForm()
-
elif choice == 2:
-
print("File import needs to be build!")
-
elif choice == 3:
-
print("Delete class needs to be build!")
-
else:
-
print ("Not correct choice!")
-
if __name__ == "__main__":
-
main()
1 1055
First, you must format you code in code tages so it can be read. Edit your post and format the code to get any help. Second do you have a specific problem? "Having problem using tkinter" is too vague to respond to. I did happen to notice - self.name = ttk.Entry(window).grid(row=0, column=1)
grid() returns None to self.name will always be None. Print it to see for yourself. Am not willing to guess further about what other problems you are having or how your code is formatted.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: nick_faye |
last post by:
Hi,
I hope somebody can help me. I am collecting data from different
external ms access database on my VB programming. I am using the SQL
command as shown below:
While strPaths(iCtr) <> ""...
|
by: Zurab |
last post by:
Hi,
I have problem to collect data received with callback from .NET dll to my managed class. I can't use map, queue or something else in managed class and can't place event delegate to my other...
|
by: olersquared |
last post by:
Hello !
Please i need a php script that can collect and send data to a specified email address using textfield and radio button and anyother form field.
thank you
|
by: Senthil |
last post by:
Hi All
We are having a VB application on SQL. But we need to collect
information from persons who will be offline to verify data and insert
new data. Generally they will be entering the data in...
|
by: Mikegtr |
last post by:
I need to collect and send data from a rs232 device- it is a simple
temperature controller.
I need to be able to collect actual temperature ,store the result in
database (mysql) and show it in...
|
by: Ankit |
last post by:
Hi guys i need to make a table to store a certain data using
Tkinter..I have searched on the group but i have not been able to find
a solution that would work for me..The thing is that i want my...
|
by: viv1tyagi |
last post by:
Hi everyone ! ! !
I'm just a month old in the world of Python and trying to develop an
application using Tkinter in which a new window pops out on a
particular button press.The code for this new...
|
by: J-Burns |
last post by:
Hello. Im a bit new to using Tkinter and im not a real pro in
programming itself... :P. Need some help here.
Problem 1:
How do I make something appear on 2 separate windows using Tkinter? By...
|
by: mulamootil |
last post by:
Hi, I have few tables and i am populating them using respective forms. However on one of the tables, there are 10 fields out of which 2 fields, I would like some other user to fill it. Is there a way...
|
by: woodsmith1007 |
last post by:
I am using Access to collect data via email. I have a problem that could be solved in one of two ways. I need to collect the unique employeeID of the individual sending the email back. I can...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |