Exemplo n.º 1
0
 def h2d(self):
     import my_constant
     import tkinter.messagebox as messagebox
     import tkinter.filedialog as filedialog
     import my_io
     import traceback
     play = self.master.master.play
     if not self.clan.h:
         FileMenu.read_h(self)
         if not self.clan.h: return
     path = filedialog.asksaveasfilename(**my_constant.donate_opt)
     if path:
         try:
             my_io.append_donate(None, path, mode='clear')
             my_io.append_history(None, path + '.clh', mode='clear')
             for item in self.clan.hv:
                 self.clan.imah.copyfrom(item)
                 play.InitFlag[0] = True
                 play.flash()
                 play.InitFlag[0] = False
                 my_io.append_donate(self.clan.imad, path, check_exist=False)
                 my_io.append_history(self.clan.imah, path+ '.clh', check_exist=False)
             play.cls()
         except Exception as e:
             print('path=%s\n%s'%(path,e))
             traceback.print_exc()
             messagebox.showerror('出错了!', '保存失败')
         else: messagebox.showinfo('保存成功!', '已保存至' + path)
Exemplo n.º 2
0
Arquivo: pad.py Projeto: lishnih/pad
    def onHelpAbout(self, event=None):
        text = """{0}\n{1}\nVersion {2}\n
Python: {3}
Package: {4}
""".format(__pkgname__, __description__, __version__,
           sys.version, __package__)
        showinfo("About", text)
Exemplo n.º 3
0
def play_game(game):
    result = ""
    while not result:
        print_game(game)
        choice = input("Cell[1-9 or q to quit]: ")
        if choice.lower()[0] == "q":
            save = mb.askyesno("Save game", "Save game before quitting?")
            if save:
                oxo_logic.save_game(game)
            quit_game()
        else:
            try:
                cell = int(choice) - 1
                if not (0 <= cell <= 8):  # check range
                    raise ValueError
            except ValueError:
                print("Choose a number between 1 and 9 or 'q' to quit ")
                continue

            try:
                result = oxo_logic.user_move(game, cell)
            except ValueError:
                mb.showerror("Invalid cell", "Choose an empty cell")
                continue
            if not result:
                result = oxo_logic.computer_move(game)
            if not result:
                continue
            elif result == "D":
                print_game(game)
                mb.showinfo("Result", "It's a draw")
            else:
                print_game(game)
                mb.showinfo("Result", "Winner is {}".format(result))
Exemplo n.º 4
0
 def save_as(self):
     import tkinter.messagebox as messagebox
     import tkinter.filedialog as filedialog
     import my_constant
     import my_io
     import traceback
     try:
         if self.clan.h:
             path = filedialog.asksaveasfilename(**my_constant.history_opt)
             if path:
                 my_io.append_history(None, path, mode='clear')
                 for item in self.clan.hv:
                     my_io.append_history(item, path, check_exist=False)
                 messagebox.showinfo('保存成功!', '已保存至' + path)
         if self.clan.d:
             path = filedialog.asksaveasfilename(**my_constant.donate_opt)
             if path:
                 my_io.append_donate(None, path, mode='clear')
                 for item in self.clan.dv:
                     my_io.append_donate(item, path, check_exist=False)
                 messagebox.showinfo('保存成功!', '已保存至' + path)
     except Exception as e:
         traceback.print_exc()
         messagebox.showerror('出错了!', '保存失败')
     self.master.master.focus_force()
Exemplo n.º 5
0
def hit_card():
	'''
	Deals a new card to be added to the players hand, can be done until sum of hand
	is over 21.
	'''
	global deck, num, hand, dealer_wins, bet, balance

	counter = [three, four, five, six]	
	next_card = deck.pop()
	hand.append(next_card)
	counter[num].display('front', next_card._id)
	num += 1

	configure(seventop)
	Double['state'] = 'disabled'

	if total(hand) > 21:
		showinfo('Game over', 'You bust, Dealer wins...')
		dealer_wins += 1
		configure(seven)
		configure(twelve, True)
		balance -= bet
		configure(ten)
		Bet['state'] = 'normal'
		unavailable()
		# new_deal()
		update()
Exemplo n.º 6
0
def checkmethod(option, window):
    selected=str(option)
    
    if selected == "()":
        messagebox.showerror("Error", "Please select an option.")
        logger.error("User chose option {}. But {} is an invaild option!".format(selected, selected))
    elif "0" in selected:
        window.destroy()
        createconvertwindow(selected)
    elif "1" in selected:
        window.destroy()
        createconvertwindow(selected)
    elif "2" in selected:
        window.destroy()
        createconvertwindow(selected)
    elif "3" in selected:
        window.destroy()
        createconvertwindow(selected)
    elif "4" in selected:
        window.destroy()
        createconvertwindow(selected)
    elif "5" in selected:
        messagebox.showinfo("Information", "Every seperate hexadecimal has to be on a new line in order to be converted correctly.")
        window.destroy()
        createconvertwindow(selected)
    else:
        logger.error("User chose option {}. But {} is an invaild option!".format(selected, selected))
        messagebox.showerror("Error", "{} is an invaild option, please try again.".format(selected))
Exemplo n.º 7
0
def check_process_thread():
    if process_thread.is_alive():
        progressbar['value'] = indicator_process
        
        root.after(20, check_process_thread)
    else:
        messagebox.showinfo("Data Processed", "Data successfully processed!")
Exemplo n.º 8
0
def sendOrder():
    theInput = inputt.get()
    inputt.delete(0, END)
    if theInput == "" or theInput == " ":
        messagebox.showinfo("Info", "Input Field can't be empty")
    else:
        Kasi.waitOrder(True, theInput)
Exemplo n.º 9
0
	def click_canvas(self, event):
		if self.current_position.color == True:
			colonne = int(event.x / 100)
			stop = True
			hasPlayed = False					
			for i in range(41 - (6 - colonne), -1, -7):				
				if self.current_position.isBit(i):		
					hasPlayed = True
					self.current_position.setBit(i, self.current_position.color)
					self.current_position.setColor(not self.current_position.color)
					self.current_position.setLast(i)
					self.display()
					if self.current_position.isWon():
						messagebox.showinfo("Bravo", "Vous avez gagné !")
						self.reset()
						stop = False
					if len(self.current_position.generate()) == 0:
						messagebox.showinfo("Pas mal", "Match nul")
						self.reset()
						stop = False						
					break
				
			if stop and hasPlayed:
				t = threading.Thread(target=self.move)
				t.start()			
Exemplo n.º 10
0
def onReturn():
    filename = var.get()
    try:
        file = codecs.open(filename,'r','utf-8').read()
        text.insert('1.0',file)
    except:
        showinfo(title='Inform!',message="File does not exist!")
Exemplo n.º 11
0
def exists():
	print('checking if the new bookid exists....' + newBookId.get())
	result  = library.existsBookId(newBookId.get())
	found = 0
	if result > 0 :
		messagebox.showinfo(message='Duplicate Book ID. Enter new ID')
		bNew.focus_set()
Exemplo n.º 12
0
 def valid_in(self, key, name, min_value, max_value):
     value = int(getattr(self, key + "_var").get())
     if value < min_value or value > max_value:
         messagebox.showinfo(message = name + " muss zwischen " + str(min_value) + 
             " und " + str(max_value) + " liegen.", icon = "warning")
         return False
     return True
Exemplo n.º 13
0
 def prepare_args_and_create_pdf(self):
     pdf_name = self.filename.get()
     if not pdf_name.endswith('.pdf'):
         pdf_name += '.pdf'
     
     if self.special_order_intvar.get():
         try:
             order_number = int(self.special_order_stringvar.get())
         except ValueError:
             messagebox.showwarning(
                 'Zły numer',
                 'Wpisano błędne dane do pola "numer spoza listy".')
             return
     else:
         current_row = self.orders_list.curselection()[0]
         current_item = self.latest_orders[-1 - current_row]
         order_number = current_item['order_number']
     
     self.print_price = self.print_price_var.get()
     self.print_product_code = self.print_product_code_var.get()
     
     errors = self.order_by_num(order_number, pdf_name)
     if errors is None:
         messagebox.showinfo('Sukces',
             'Plik ' + pdf_name + ' został utworzony.')
     elif isinstance(errors, str):
         messagebox.showwarning(
             'Błąd',
             errors)
     else:
         errors_str = '\n'.join(errors)
         messagebox.showwarning(
             'Błąd w pliku pdf',
             'Następujące wiersze mają złe numery porządkowe:\n' + errors_str)
Exemplo n.º 14
0
def formatReturnData(checkBookList,varReturnList):
	global user
	print(user)	
	idList=[]
	print(varReturnList[0].get())
	index = 0
	newCheckList = []
	for var in varReturnList:
		if (var.get()):
			idList.append(checkBookList[index][0])
		else:
			newCheckList.append(checkBookList[index][0])
		index = index + 1
	'''



	indexes = infoListBox.curselection()
	for index in indexes:
		tempid = infoListBox.get(index)[0]
		idList.append(tempid)
		'''
	result = library.returnQuery(user,idList)
	

	if result:
		messagebox.showinfo(message='You have successfully returned the books')
		
	else:
		messagebox.showinfo(message='error')

	#resetReturnData()
	print(newCheckList)
	formatShowUserInfo()
Exemplo n.º 15
0
 def ouvrirDialogue1(self):
     if messagebox.askquestion("Joueur 1", "Voulez vous placez les vaisseausx aléatoirement?")=="no":
         showinfo("Joueur 1", "Placez votre vaisseau en cliquant sur 5 cases de votre grille !!")
         self.placer_vaisseaux1()
     else:
         self.B.config(state=DISABLED)
         self.placerVaisseauAleatoire()
Exemplo n.º 16
0
 def ouvrirDialogue2(self):
     if messagebox.askquestion("Joueur 2", "Voulez vous placez les vaisseausx aléatoirement?")=="no":
         showinfo("Joueur 2", "Placez votre vaisseau en cliquant sur 5 cases de votre grille !!")
         self.placer_vaisseaux2()
     else:
         self.placerVaisseauAleatoire2()
             
Exemplo n.º 17
0
 def start_youtube_dl(self):
     # Start downloading the specified url
     if self._output_path.get():
         output_path = self._output_path.get()
     else:
         try:
             output_path = os.path.dirname(os.path.abspath(__file__))
         except NameError:
             import sys
             output_path = os.path.dirname(os.path.abspath(sys.argv[0]))
     output_tmpl = output_path + '/%(title)s-%(id)s.%(ext)s'
     options = {
         'format': 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio/best',
         'merge_output_format': 'mp4',
         'socket_timeout': '15',
         'progress_hooks': [self._logger.log],
         'ignoreerrors': True,
         'outtmpl': output_tmpl,
     }
     if self._extract_audio.get():
         options['format'] = 'bestaudio/best',
         options['postprocessors'] = [{
             'key': 'FFmpegExtractAudio',
             'preferredcodec': 'mp3',
             'preferredquality': '3',
         }]
     dl = YoutubeDL(options)
     status = dl.download([self._video_url.get()])
     if status != 0:
         mbox.showerror("youtube-dl error", "An error happened whilst processing your video(s)")
     else:
         mbox.showinfo("youtube-dl finished", "Your video(s) have been successfully processed")
Exemplo n.º 18
0
    def write_actions(self, model_name, icon_name, item_actions):
        viewer_file = join(
            dirname(self.full_modulepath), 'views_%s.py' % model_name.lower())
        is_new = not isfile(viewer_file)
        with open(viewer_file, 'wb') as self.viewfile:
            self._write_header(model_name, item_actions, is_new)
            class_inst = getattr(self.module_obj, model_name)
            verbose_name = six.text_type(class_inst._meta.verbose_name)
            verbose_name_plural = six.text_type(
                class_inst._meta.verbose_name_plural)
            for item_name in sorted(list(item_actions.keys())):
                acts = item_actions[item_name]
                actions, caption, right, menuext = self._define_params(
                    model_name, item_name, acts, verbose_name, verbose_name_plural)
                self.writedata("""
@ActionsManage.affect('%(modelname)s', %(actions)s)
@MenuManage.describ('%(right)s'%(menuext)s)
class %(modelname)s%(itemname)s(%(classname)s):
    icon = "%(iconname)s"
    model = %(modelname)s
    field_id = '%(fieldidname)s'
    %(caption)s
""" % {'modelname': model_name, 'iconname': icon_name, 'fieldidname': model_name.lower(), 'itemname': item_name[1:],
                    'classname': LIST_VIEWER[item_name][0], 'actions': actions, 'caption': caption, 'right': right, 'menuext': menuext})
        showinfo("View generator", "Views generated in %s" %
                 os.path.relpath(viewer_file, self.project_path))
Exemplo n.º 19
0
 def show_help(self):
     messagebox.showinfo('Руководство',
     """
     После запуска приложения открывается стартовое окно, где
     пользователь вводит параметры для задания эллиптической
     кривой, p, a, b. (p должно быть простым, a<0, b>0 и b<p).
     После ввода данных перед пользователем открывается окно
     с двумя кнопками "Генерация подписи" и "проверка подписи".
     При нажатии "Генерация подписи", перед пользователем
     открывается окно "Генерация ЭЦП". В этом окне пользователь
     может видеть уравнение эллиптической кривой, порядок
     эллиптической кривой,
     генерирующую точку которую выбрал пользователь, порядок
     генерирующей точки, после нажатия "Генерация ключей"
     пользователь видит, что сгенерирован открытый ключ и
     случайное число k.
     При нажатии "Хеширования текста" открывается окно где
     пользователь вводит сообщение, после чего нажимает кнопку
     "Рассчитать хэш" и нажимает "ОК". Нажимая кнопку
     "Генерация подписи", пользователь может видеть подпись
     которая получилась.Если же подпись уже есть, то
     пользователь выбирает кнопку "Проверка подписи". После
     нажатия на соответствующую кнопку открывается окно
     "Проверка ЭЦП", в котором так же можно видеть уравнение
     эллиптической кривой, порядок эллиптической кривой,
     генерирующую точку которую выбрал пользователь, порядок
     генерирующей точки. И кнопки "Хеширование текста" так
     же идет расчет хэша сообщения и после этого пользователь
     проводит проверку подписи, нажимая на данную кнопку
     пользователь видит в открывшемся окне поле, в которое
     нужно ввести текст для проверки, а так же поля для ввода
     открытого ключа и самой подписи.
     """)
Exemplo n.º 20
0
 def __init__(self, baudrate, port):
     try:
         self.serialComm = serial.Serial(port, baudrate)
         self.connected = True
     except serial.SerialException:
         messagebox.showinfo("Error", "Could not connect to port " + str(port) + " using baudrate " + str(baudrate) + "!")
         self.connected = False
Exemplo n.º 21
0
 def show_about_dialog(self):
     from platform import python_version
     showinfo('About Face Transfer', 'Face Transfer {0} \n\n'
              'Programmed in 2015 by nycz.\n\nLicensed under GPL. See the '
              'sourcecode for more info.\n\nMade to run on Python 3.4 or '
              'above.\n\nRunning on python version: {1}'
              ''.format(version, python_version()))
Exemplo n.º 22
0
	def delete_files(self):
		if self.default_algorithm.get() == 'Zero fill':
			method = 0
		if self.default_algorithm.get() == 'Secure Erase':
			method = 1
		if self.default_algorithm.get() == 'Schneier':
			method = 2
		if self.default_algorithm.get() == 'Random Data':
			method = 3
		path = '\\\\.\\' + self.default_drive.get() + ':'
		if 'File System Type: NTFS' in get_file_system(path):
			selection = self.files_list.curselection()
			value = list(map(lambda x: self.files_list.get(x),selection))
			delete_files = []
			for filename in value:
				for directory in self.files_in_drive:
					if directory['dir_path'] == filename:
						delete_files.append(directory)
						break
					for files in directory['list_child']:
						if files['dir_path'] == filename:
							delete_files.append(files)
							break
			for files in delete_files:
				deletion(files,method)
			self.files_list.delete(0,tk.END)
			rootPath = self.default_drive.get()
			self.files_in_drive = getfiles(path,rootPath)
			for directory in self.files_in_drive:
				self.files_list.insert(tk.END,directory['dir_path'])
				for files in directory['list_child']:
					self.files_list.insert(tk.END,files['dir_path'])
			messagebox.showinfo('Delete Files','Done!')
		else:
			messagebox.showwarning('Error','NTFS only!')
Exemplo n.º 23
0
    def jouer1(self,event): 
        bool = "true"
        if(self.grille.getCasePos(event.x//40,event.y//40,1).getsituation()==1):
            self.grille.getCasePos(event.x//40,event.y//40,1).setsituation(2)
            self.vaisseauxTrouve1 = self.vaisseauxTrouve1 + 1
            self.score1 = self.score1 + 50
            Jouer.afficherScore.ScoreJ1.set(self.score1)
            

        elif(self.grille.getCasePos(event.x//40,event.y//40,1).getsituation()==2):
            self.joueur1()
        
        elif(self.grille.getCasePos(event.x//40,event.y//40,1).getcouleur() == "red"):
            self.joueur1()
            bool = "false"
            
        else:
            self.grille.getCasePos(event.x//40,event.y//40,1).setcouleur("red")
            self.joueur2()
        self.grille._dessiner_grille()
        
        if(self.grille.getCasePos(event.x//40,event.y//40,1).getsituation()==0 and bool == "true" ):            
            showinfo("Au joueur 2 de jouer", "Essayez de trouvez le vaisseau du joueur 1  !!")
        if(self.vaisseauxTrouve1 == 5):
            self.fin_jeux("Joueur 1")
Exemplo n.º 24
0
def formatAddNewBookData(id,title,author):
	if(id ==''):
		messagebox.showinfo(message="Book ID is required.")
		return
	
	library.addNewBook(id,title,author)
	resetAddNewBookData()
Exemplo n.º 25
0
    def jouer2(self,event): 
        bool = True
        if(self.grille.getCasePos(event.x//40,event.y//40,2).getsituation()==1):
            self.grille.getCasePos(event.x//40,event.y//40,2).setsituation(2)
            self.vaisseauxTrouve2 = self.vaisseauxTrouve2 + 1
            self.score2 = self.score2 + 50
            Jouer.afficherScore.ScoreJ2.set(self.score2)



        elif(self.grille.getCasePos(event.x//40,event.y//40,2).getsituation()==2):
            self.joueur2()

        elif(self.grille.getCasePos(event.x//40,event.y//40,2).getcouleur() == "red"):
            self.joueur2()
            bool = False
             
        else:
            self.grille.getCasePos(event.x//40,event.y//40,2).setcouleur("red")
            self.joueur1()
        self.grille._dessiner_grille()
        
        if(self.grille.getCasePos(event.x//40,event.y//40,2).getsituation()==0 and bool == True):            
            showinfo("Joueur 1", "Au joueur 1 de jouer !!")
        if(self.vaisseauxTrouve2 == 5):
            self.fin_jeux("Joueur 2")
Exemplo n.º 26
0
def callback(pos):
    """
    Lida com o evento do pressionamento de um botão
    Recebe a posição de pressionamento do botão
    """
    # Declara as variáveis globais
    global JOGADOR, BOTOES, TAB, VALORES, JOGANDO
     
    # Se o botão já foi pressionado anteriormente não devemos mudar seu texto
    if BOTOES[pos]["text"] != "" or not JOGANDO:
        return
     
    # Colocamos um valor apropriado no botão
    BOTOES[pos].config(text= VALORES[JOGADOR])
 
    # E adicionamos ao Tabuleiro
    TAB[pos[0]*3 + pos[1]] = JOGADOR
 
    # Verificamos se há vitória ou derrota
    if ganhou():
        # Se há nós colocamos uma mensagem na tela
        messagebox.showinfo("Fim de Jogo", "O jogador %i (%s) ganhou"%(int(JOGADOR) + 1, VALORES[JOGADOR]))
        JOGANDO = False
 
    # Verificamos se há empate
    if sum(TAB) == 4:
        messagebox.showinfo("Fim de Jogo", "Empate!")
        JOGANDO = False
 
    # E trocamos o jogador
    JOGADOR = not JOGADOR
Exemplo n.º 27
0
 def mem_new(self, c=[0]):
     from my_class import Member
     new = self.name.get(), self.abbr.get(), self.level.get(), self.rank.get()
     if not new[0]: return
     flag = not new[1]
     kw = {}
     kw['name'], kw['abbr'], kw['level'], kw['rank'] = new
     kw['abbr'] = ( kw['abbr'] or '%d'%c[0] ).rjust(3,'_')
     kw['level'] = int (kw['level'] or 1)
     kw['rank'] = kw['rank'] or kw['level'] * 100
     title = "添加成员"
     message = "新成员信息:\n  Name: %s\n  Abbr: %s\n  Town Hall Lv: %s\n  Rank: %s"\
               ""%(kw['name'], kw['abbr'], kw['level'], kw['rank'])
     if kw['abbr'] in self.clan.member:
         messagebox.showwarning("错误!","该缩写已存在,如需帮助请联系Ceilopty")
         return
     if not messagebox.askyesno(title, message): return
     try:
         new = Member(self.clan, **kw)
         self.clan[kw['abbr']] = new
     except BaseException as e:
         messagebox.showwarning("成员创建失败","错误:%s\n如有疑问请咨询Ceilopty"%e)
     else:
         self.unsaved = True
         if flag: c[0] += 1
         messagebox.showinfo("成员创建成功","即日起成员%s可以参战!"%kw['name'])
         self.flash()
Exemplo n.º 28
0
 def deleteExistingContact(self):
     global namereal
     confirm = messagebox.askyesno(title = 'Please Confirm', message = 'Are you sure you want to delete {} from your contacts'.format(namereal))
     if confirm == True:
         deleteContact(namereal)
         self.refreshContactList()
         messagebox.showinfo(title = 'Confirmed!', message = 'Your contact {} has successfully been deleted from your address book!'.format(namereal))
Exemplo n.º 29
0
def savefile(master, text):
    try:
        filename = filedialog.asksaveasfilename(filetypes=(("Text files", "*.txt"),
                                                         ("All files", "*.*") ))
        if bAppendtxtwhensaving == 1:
            filename = filename + ".txt"
        
        if not filename == "":
            txtcontent = iolib.writetotextfile(text, filename)
            if txtcontent == 1:
                print("Something went wrong while saving : %s.\n Does this user have to approrite permissions to the file?" % (filename))
                messagebox.showerror("Error", "Something went wrong while saving to: %s.\n Do you have the approrite permissions to the file?" % (filename))
            else:
                conversionsaved=1
                print("Saved conversion to %s." % (filename))
                messagebox.showinfo("Saved", "Saved conversion to %s." % (filename))
                # print(txtcontent) # debugging purposes.
        else:
            # print("passed") # debugging purposes.
            pass
    except Exception as e:
        print("Error while loading file picker.\n %s." % (str(e)))
        messagebox.showerror("Error", "Error while loading file save.\n %s." % (str(e)))
        filename = 1
    return filename
Exemplo n.º 30
0
def onReturnKey():
    cmdline = ('python getfile.py -mode client -file %s -port %s -host %s' %
               (content['File'].get(),
                content['Port'].get(),
                content['Server'].get()))
    os.system(cmdline)
    showinfo('getfilegui-1', 'Download Complete')
Exemplo n.º 31
0
from urllib.request import urlopen
from zipfile import ZipFile
from os import remove
from subprocess import Popen
from tkinter import filedialog, messagebox
from tkinter import *

root = Tk()
root.withdraw()
messagebox.showinfo(
    "Electable Installer",
    "Electable (c) 2019 Romir Kulshrestha\n<*****@*****.**>\n\nThe use of this software is governed by the MIT License. For more information, see license.txt."
)
if not messagebox.askokcancel(
        "Electable Installer | MongoDB",
        "This software requires NodeJS and MongoDB to be installed. If they are not installed, click 'Cancel' below and install them before proceeding."
):
    exit(0)
messagebox.showinfo("Electable Installer | MongoDB",
                    "Please select the location of MongoDB (mongod.exe).")
root.mongodir = filedialog.askdirectory()
print("MongoDB: ", root.mongodir)
messagebox.showinfo("Electable Installer | Installation directory",
                    "Please select the location to install to.")
root.installdir = filedialog.askdirectory()
print("Root: ", root.installdir)

dist = 'https://github.com/romirk/election/blob/master/dist/electable.zip?raw=true'
print("Downloading...")
tmp = open(root.installdir + '/electable.zip', 'wb+')
zipcontents = urlopen(dist).read()
Exemplo n.º 32
0
def validate_length(key_dec):

    if len(key_dec.split('.')) != 32:
        messagebox.showinfo('Error', 'Length of key is wrong!')
Exemplo n.º 33
0
def results(GPA):
	msg.showinfo("Results",f"your GPA is\n {GPA}")
	root.destroy()
Exemplo n.º 34
0
 def click(self, event):
     from tkinter import messagebox
     # 获取Listbox当前选中项
     messagebox.showinfo(title=None, message=str(self.lb.curselection()))
Exemplo n.º 35
0
Tops.pack(side=TOP)

f1 = Frame(root, width=900, height=700)
f1.pack(side=LEFT)

f2 = Frame(root, width=400, height=700)
f2.pack(side=RIGHT)

#TOP
lblinfo = Label(Tops,
                font=('aria', 30, 'bold'),
                text="Room Management System",
                fg="steel blue",
                bd=10)
lblinfo.grid(row=0, column=0)
messagebox.showinfo("Hello", "Welcome to our hotel")


def qexit():
    root.destroy()


def reset():
    adhar.set("")
    Fname.set("")
    Lname.set("")
    contact.set("")
    loc.set("")


adhar = StringVar()
Exemplo n.º 36
0
 def ShowInformationDialog(self, message, title="Information"):
     return messagebox.showinfo(title, message)
Exemplo n.º 37
0
    def cg4(self):
        

        #upto=w.get()
        #print(upto)
        cgpa_index=[]
        sem1_index=[]
        sem2_index=[]
        sem3_index=[]
        sem4_index=[]
        sem5_index=[]
        sem6_index=[]
        sem7_index=[]
        sem8_index=[]
        path=os.environ["HOMEPATH"]
        os.chdir(path)
        os.chdir("Desktop\\gpa")
        wb0=op.load_workbook('sem1.xlsx')
        sh0=wb0['Sheet1']

        cnt=sh0.max_row

        for i in range(3,cnt+1):
            if (sh0.cell(row=i,column=3).value and sh0.cell(row=i+1,column=3).value)==None:
                break
        cnt=i



        c=op.load_workbook('cgpa_sheet.xlsx')
        sh01=c['Sheet1']
    

        for i in range(4,cnt+1):
            sh01.cell(row=i,column=1).value=str(sh0.cell(row=i,column=1).value)
            sh01.cell(row=i,column=2).value=sh0.cell(row=i,column=2).value

        c.save('cgpa_sheet.xlsx')



        import semester_1
        import semester_2
        import semester_3
        import semester_4
        wb1=op.load_workbook('sem1.xlsx')
        wb2=op.load_workbook('sem2.xlsx')
        wb3=op.load_workbook('sem3.xlsx')
        wb4=op.load_workbook('sem4.xlsx')
        sh1=wb1['Sheet1']
        sh2=wb2['Sheet1']
        sh3=wb3['Sheet1']
        sh4=wb4['Sheet1']

        for i in range(4,cnt+1):
            sem1_index.append(sh1.cell(row=i,column=sh1.max_column).value)
            sem2_index.append(sh2.cell(row=i,column=sh2.max_column).value)
            sem3_index.append(sh3.cell(row=i,column=sh3.max_column).value)
            sem4_index.append(sh4.cell(row=i,column=sh4.max_column).value)

        no_of_grades=len(sem1_index)

        for i in range(1,no_of_grades+1):
            sum_up=((float(sem1_index[i-1])+float(sem2_index[i-1])+float(sem3_index[i-1])+float(sem4_index[i-1]))/float(4))
            cgpa_index.append(float('%.2f'%sum_up))

        wb=op.load_workbook('cgpa_sheet.xlsx')
        sh=wb['Sheet1']
        no_of_grades=len(cgpa_index)

        for i in range(4,cnt+1):

            sh.cell(row=i,column=3).value=sem1_index[i-4]
            sh.cell(row=i,column=4).value=sem2_index[i-4]
            sh.cell(row=i,column=5).value=sem3_index[i-4]
            sh.cell(row=i,column=6).value=sem4_index[i-4]

            sh.cell(row=i,column=7).value=cgpa_index[i-4]

        sh.cell(row=3,column=3).value='SEMESTER_1'
        sh.cell(row=3,column=4).value='SEMESTER_2'
        sh.cell(row=3,column=5).value='SEMESTER_3'
        sh.cell(row=3,column=6).value='SEMESTER_4'

        sh.cell(row=3,column=7).value='CGPA'




        if sh.cell(row=4,column=4).value!=None:
            msg.showinfo("SUCCESS","CGPA VALUES UPDATED IN 'cgpa_sheet' SHEET!!")

        else:
            msg.showinfo("SUCCESS","CGPA ERROR!!")

        wb.save('cgpa_sheet.xlsx')