コード例 #1
0
ファイル: agenda.py プロジェクト: williangoulartt/PythonCodes
    def remover(self):
        nome = self.nome.get()
        if not len(nome):
            Dialog(self,
                   title="Erro!",
                   text="Nome inválido",
                   bitmap='error',
                   default=0,
                   strings=('OK', ))
            return

        if not self.db.has_key(nome):
            Dialog(self,
                   title="Erro!",
                   text="Nome não encontrado",
                   bitmap='error',
                   default=0,
                   strings=('OK', ))
            return

        self.endereco.set(self.db.get(nome, "")[0])
        self.telefone.set(self.db.get(nome, "")[1])

        resposta = Dialog(self,
                          title="Confirmação",
                          text="Deseja remover?",
                          bitmap='question',
                          default=1,
                          strings=('Sim', 'Não'))
        if resposta.num == 0:
            del self.db[nome]
            self.limpaCampos()
コード例 #2
0
 def gravar(self):
     nome = self.nome.get()
     if not len(nome):
         Dialog(self, title="Erro!", text="Nome inválido", bitmap= 'error', default=0, strings=('OK',))
         return
     if not db.has_key(nome):
         Dialog(self, title="Erro!",\
             text="Nome inexistente, adicione um novo contanto",\
                 bitmap= 'error', default= 0 strings = ('OK',))
         return
     self.db[nome]=(self.endereco.get(),self.teçefone.get())
     self.limparCampos()
コード例 #3
0
 def procurar(self):
     nome = self.nome.get()
     if not len(nome):
         Dialog(self, title="Erro!", text="Nome não encontrado", \
             bitmap='Error', default=0, strings=('OK',) )
         return
     if not self.db.has_key(nome):
         Dialog(self, title="Erro!", text="Nome não encontrado", \
             bitmap ='error', default=0, strings= ('OK',))
         return
     
     self.telefone.set(self.db.set(nome, "")[0])
     self.endereco.set(self.db.set(nome, "")[1])
コード例 #4
0
 def adicionar(self):
     nome = self.nome.get()
     if not nome:
         Dialog(self, title="Erro!", text="Nome inválido", \
                      bitmap='error', default=0, strings=('OK',))
         return
     
     if nome in self.db:
         Dialog(self, title="Erro!", text="Nome já cadastrado", \
                      bitmap='error', default=0, strings=('OK',))
         return
     
     self.db[nome] = (self.endereco.get(), self.telefone.get())
     self.limpaCampos()
コード例 #5
0
 def gravar(self):
     nome = self.nome.get()
     if not nome:
         Dialog(self, title="Erro!", text="Nome inválido",
                      bitmap='error', default=0, strings=('OK',))
         return
     
     if nome not in self.db:
         Dialog(self, title="Erro!", \
                      text="Nome inexistente, use o botão adicionar", \
                      bitmap='error', default=0, strings=('OK',))
         return
     
     self.db[nome] = (self.endereco.get(), self.telefone.get())
     self.limpaCampos()
コード例 #6
0
 def ok_command(self):
     file = self.get_selection()
     if os.path.exists(file):
         if os.path.isdir(file):
             self.top.bell()
             return
         d = Dialog(self.top,
                    title="File Exists",
                    text="Overwrite existing file %s?" % ` file `,
                    bitmap='questhead',
                    default=1,
                    strings=("Overwrite", "Append", "Cancel"))
         if d.num == 2:
             return
         elif d.num == 0:
             self.mode = 'w'
         elif d.num == 1:
             self.mode = 'a'
     else:
         head, tail = os.path.split(file)
         if not os.path.isdir(head):
             self.top.bell()
             return
         self.mode = 'w'
     self.quit(file)
コード例 #7
0
 def sair(self):
     resposta = Dialog(self, title="Confirmação",
                       text="Tem certeza que deseja sair?",
                       bitmap='question', default=1,
                       strings=('Sim', 'Não'))
     if resposta.num == 0:
         self.quit()
コード例 #8
0
 def quit(self):
     ans = Dialog(self,
                  title='Verify quit ',
                  text='Are you sure you want to quit?',
                  bitmap='question',
                  default=1,
                  strings=('Yes', 'No'))
コード例 #9
0
 def notdone(self):
     Dialog(self,
            title='Not implemented',
            text='Not yet available',
            bitmap='error',
            default=0,
            strings=('OK', ))
コード例 #10
0
 def greeting(self):
     Dialog(self,
            title='greeting',
            text='Howdy',
            bitmap='',
            default=0,
            strings=('hi', ))
コード例 #11
0
 def dialog2(self):
     Dialog(self,
            title='title',
            text="text",
            bitmap='hourglass',
            default=0,
            strings=('spam', 'SPAM'))
コード例 #12
0
ファイル: ShellWindow.py プロジェクト: olympu/ancient-pythons
	def outputhandler(self, file, mask):
		data = os.read(file, BUFSIZE)
		if not data:
			self.tk.deletefilehandler(file)
			pid, sts = os.waitpid(self.pid, 0)
			print 'pid', pid, 'status', sts
			self.pid = None
			detail = sts>>8
			cause = sts & 0xff
			if cause == 0:
				msg = "exit status %d" % detail
			else:
				msg = "killed by signal %d" % (cause & 0x7f)
				if cause & 0x80:
					msg = msg + " -- core dumped"
			Dialog(self.master, {
				'text': msg,
				'title': "Exit status",
				'bitmap': 'warning',
				'default': 0,
				'strings': ('OK',),
			})
			return
		self.insert('end', data)
		self.pos = self.index('end')
		self.yview_pickplace('end')
コード例 #13
0
ファイル: guimixin.py プロジェクト: komakim/python_training
 def infobox(self, title, text, bitmap='', strings=('OK', )):
     Dialog(self,
            title=title,
            text=text,
            bitmap=bitmap,
            default=0,
            strings=strings)
コード例 #14
0
ファイル: guimixin.py プロジェクト: komakim/python_training
 def question(self, title, text, bitmap='question', strings=('Yes', 'No')):
     return Dialog(self,
                   title=title,
                   text=text,
                   bitmap=bitmap,
                   default=1,
                   strings=strings).num
コード例 #15
0
    def makeWindow(self):
        """Create a top-level dialog with some buttons.

        This uses the Dialog class, which is a wrapper around the Tcl/Tk
        tk_dialog script.  The function returns 0 if the user clicks 'yes'
        or 1 if the user clicks 'no'.
        """
        # the parameters to this call are as follows:
        d = Dialog(
            self,  ## name of a toplevel window
            title="fred the dialog box",  ## title on the window
            text="click on a choice",  ## message to appear in window
            bitmap="info",  ## bitmap (if any) to appear;
            ## if none, use ""
            #     legal values here are:
            #      string      what it looks like
            #      ----------------------------------------------
            #      error       a circle with a slash through it
            #      grey25      grey square
            #      grey50      darker grey square
            #      hourglass   use for "wait.."
            #      info        a large, lower case "i"
            #      questhead   a human head with a "?" in it
            #      question    a large "?"
            #      warning     a large "!"
            #        @fname    X bitmap where fname is the path to the file
            #
            default=0,  # the index of the default button choice.
            # hitting return selects this
            strings=("yes", "no"))
        # values of the 'strings' key are the labels for the
        # buttons that appear left to right in the dialog box
        return d.num
コード例 #16
0
ファイル: gui7.py プロジェクト: komakim/python_training
 def dialog2(self):
     Dialog(self,
            title='HAL-9000',
            text="I'm afraid I can't let you do that, Dave",
            bitmap='hourglass',
            default=0,
            strings=('spam', 'SPAM'))
コード例 #17
0
ファイル: kali.py プロジェクト: sh1nu11bi/kali-scripts
 def dialog1(self):
     ans = Dialog(self,
                  title   = 'Title!',
                  text    = 'text'
                            'and text "quotation".',
                  bitmap  = 'questhead',
                  default = 0, strings = ('Yes', 'No', 'Cancel'))
コード例 #18
0
ファイル: ShellWindow.py プロジェクト: Greentwip/python27-uwp
 def no_process(self):
     Dialog(self.master,
            text="No active process",
            title="No process",
            bitmap='error',
            default=0,
            strings=('OK',))
コード例 #19
0
ファイル: ShellWindow.py プロジェクト: Greentwip/python27-uwp
 def outputhandler(self, file, mask):
     data = os.read(file, BUFSIZE)
     if not data:
         self.tk.deletefilehandler(file)
         pid, sts = os.waitpid(self.pid, 0)
         print 'pid', pid, 'status', sts
         self.pid = None
         detail = sts>>8
         cause = sts & 0xff
         if cause == 0:
             msg = "exit status %d" % detail
         else:
             msg = "killed by signal %d" % (cause & 0x7f)
             if cause & 0x80:
                 msg = msg + " -- core dumped"
         Dialog(self.master,
                text=msg,
                title="Exit status",
                bitmap='warning',
                default=0,
                strings=('OK',))
         return
     self.insert(END, data)
     self.pos = self.index("end - 1 char")
     self.yview_pickplace(END)
 def dialog1(self):
     ans = Dialog(self,
                  title   = 'Popup Fun!',
                  text    = 'An example of a popup-dialog '
                            'box, using older "Dialog.py".',
                  bitmap  = 'questhead',
                  default = 0, strings = ('Yes', 'No', 'Cancel'))
     if ans.num == 0: self.dialog2()
コード例 #21
0
ファイル: Window.py プロジェクト: xiaocaiyidie/weiClient
 def openDialogWindow(self):
     if self.DialogWindow != None:
         self.DialogWindow.show()
         return
     self.DialogWindow = Dialog()
     self.DialogWindow.show()
     qe = QEventLoop()
     qe.exec_()
コード例 #22
0
ファイル: gui7.py プロジェクト: komakim/python_training
 def dialog1(self):
     ans = Dialog(self,
                  title='popup fun!',
                  text='an example',
                  bitmap='questhead',
                  default=0,
                  strings=('yes', 'no', 'cancel'))
     if ans.sum == 0:
         self.dialog2()
コード例 #23
0
 def queryNumberOfColors(self):
     """Ask the user how many colors to use for secret pattern."""
     inputOptions = []
     for i in range(2, len(self._colorNames) + 1):
         inputOptions.append(str(i))
     dialog = Dialog('How many colors are available?', inputOptions,
                     'Number of color', 500)
     self._numberOfColors = int(dialog.display())
     return self._numberOfColors
コード例 #24
0
    def remover(self):
        nome = self.procurar()

        resposta = Dialog(self, title="Confirmação", \
                   text="Deseja remover?", \
                   bitmap='question', default=1, strings=('Sim', 'Não'))
        if resposta.num == 0:
            del self.db[nome]
            self.limpaCampos()
コード例 #25
0
    def gravar(self):
        nome = self.nome.get()
        if not len(nome):
            Dialog(self,
                   title="Erro!",
                   text="Nome inválido",
                   bitmap='error',
                   default=0,
                   strings=('OK', ))
            return

        if not self.db.has_key(nome):
            Dialog(self, title="Erro", \
                         text="Este nome não está registrado, use o botão adicionar", \
                         bitmap='error', default=0, strings=('OK',))
            return

        self.db[nome] = (self.endereco.get(), self.telefone.get())
        self.limpaCampos()
コード例 #26
0
def main():
    dialog = Dialog()
    panel = Panel()
    ok = Button("Ok")
    cancel = Button("Cancel")
    panel.add_children(ok)
    panel.add_children(cancel)
    dialog.add_children(panel)

    ok.show_help()
コード例 #27
0
ファイル: FIEStool.py プロジェクト: crawfordsm/HRSTool
    def really_quit(self):

        "Double-check with the user if this frame (and thus the program) really should terminate."
        answer = Dialog(self,
                        title='',
                        bitmap='',
                        strings=('Yes', 'No'),
                        text='Really quit?',
                        default=1)
        if answer.num == 0: self.quit()
コード例 #28
0
ファイル: Role.py プロジェクト: zhaolei1/ulteo4Kode4kids
	def __init__(self, main_instance):
		AbstractRole.__init__(self, main_instance)
		self.dialog = Dialog(self)
		self.has_run = False
		
		self.server = None
		self.ssl_ctx = None
		self.processes = {}
		
		self.kill_mutex = threading.Lock()
コード例 #29
0
    def procurar(self):
        busca = self.nome.get()
        if not busca:
            Dialog(self, title="Erro!", text="Nome inválido", \
                         bitmap='error', default=0, strings=('OK',))
            return

        try:
            nome, endereco, telefone = self._busca(busca)
        except NotFound:
            Dialog(self, title="Erro!", text="Nome não encontrado", \
                         bitmap='error', default=0, strings=('OK',))
            return

        self.nome.set(nome)
        self.endereco.set(endereco)
        self.telefone.set(telefone)

        return nome
コード例 #30
0
 def test(self):
     """ only a Test Situation """
     dialog = Dialog()
     self.ui_functions.showDialog(dialog, "Information",
                                  "Heute ist ein \n schöner Tag", "warning",
                                  "Cancel", "OK")
     # which Button was pressed
     if dialog.leftButton is True:
         print("Left")
     if dialog.rightButton is True:
         print("Right")