this is a software that you ill have to login ells i will shut-down
i used the threading so the Tk gui.would keep on going
but it wont stop after 0. its not a problem its just iterating me knowing its in the background. so is there any way to get it to stop.
and is there any way to use a **** password font for the entry.
# -*- coding: cp1252 -*-
#user/bin/python!
import threading
import os
from Tkinter import *
from time import *
#os.system("shutdown -s")
class loginScreen:
def __init__(self):
def log():
if self.user.get() == 'XXXX' and self.password.get()== 'XXXXX':
main()
self.root.destroy()
print 'welcome'
else:
print 'wrong password'
self.root = Tk(screenName=None, baseName=None, className='start screen', useTk=1)
self.str_1 = StringVar()
#self.root.protocol('WM_DELETE_WINDOW', self.root)
self.root.title('Login')
self.root.geometry('300x200+270+50')
self.userlabel = Label(self.root,text='Användarnamn')
self.user = Entry(self.root)
self.passwordlab = Label(self.root,text='lösenord')
self.password = Entry(self.root)
self.Time = Label(self.root,textvariable = self.str_1,fg='green',bg='black')
self.Time.pack()
self.userlabel.pack()
self.user.pack()
self.passwordlab.pack()
self.password.pack()
self.logon = Button(self.root,text = 'Login',command = log)
self.logon.pack()
def count(self):
while True:
sleep(1.0) # give mainloop time to start
Time = 59
inloged = False
while not inloged:
sleep(1)
Time -= 1
print self.str_1.get()
self.str_1.set('stänger av om: ' + str (Time))
if Time == 0:
print 'bye bye :)'
inloged = True
self.root.destroy()
self.t = threading.Thread(target=count, args=(self.root,))
self.t.setDaemon(True)
self.t.start()
self.root.mainloop()
##===============================================================
if "__main__" == __name__ :
LS=loginscreen()