Beispiel #1
0
    def help(self):
	d = SimpleDialog.SimpleDialog(self.master, 
				      text=usageText(),
				      buttons=["Done"],
				      default=0,
				      title="Help")
	d.go()
Beispiel #2
0
    def new(self):

        self.selection_clear()

        dialog = SimpleDialog(
            self.root,
            text="Select data type",
            buttons=["int", "dbl", "logical", "char", "cancel"])
        status = dialog.go()
        if (status == 0):
            ma_type = INT
        elif (status == 1):
            ma_type = DBL
        elif (status == 2):
            ma_type = LOGICAL
        elif (status == 3):
            ma_type = 1000
        else:
            self.set_text("")
            return
# end if

        name = tkSimpleDialog.askstring("xrtdb", "Enter name")
        if (not name):
            self.set_text("")
            return
# end if

        self.set_text("Edit %s of type %s" %
                      (name, self.ma_type_name(ma_type)))
        self.delete_tmpfile()
        self.write_tmpfile(
            "Replace this file with your data of type %s" %
            self.ma_type_name(ma_type), 1000)
        self.process_tmpfile(name, ma_type, 1)
Beispiel #3
0
 def submit(self):
     if 0 in self.result:
         # 创建一个SimpleDialog
         # buttons:显示的按钮
         # default:默认选中的按钮
         dlg = SimpleDialog(self.root,
                            text='你有未选择的题目!',
                            buttons=['确定'],
                            default=0,
                            )
         # 执行对话框
         dlg.go()
     else:
         self.label.destroy()
         self.itema.destroy()
         self.itemb.destroy()
         self.itemc.destroy()
         self.itemd.destroy()
         self.iteme.destroy()
         self.preBt.destroy()
         self.submitBt.destroy()
         score = sum(self.result)
         if score >180:
             label = Message(self.root,text="心理测试结果 :")
             label.place(x=20,y=40)
             message = Message(self.root, text="意志力强,头脑冷静,有较强的领导欲,事业心强,不达目的不罢休。外表和善,内心自傲,对有利于自己的人际关系比较看重,有时显得性格急噪,咄咄逼人,得理不饶人,不利于自己时顽强抗争,不轻易认输。思维理性,对爱情和婚姻的看法很现实,对金钱的欲望一般。 ")
             message.pack()
         elif score >140:
             label = Message(self.root, text="心理测试结果 :")
             label.place(x=20, y=40)
             message = Message(self.root,
                               text="聪明,性格活泼,人缘好,善于交朋友,心机较深。事业心强,渴望成功。思维较理性,崇尚爱情,但当爱情与婚姻发生冲突时会选择有利于自己的婚姻。金钱欲望强烈。")
             message.pack()
         elif score > 100:
             label = Message(self.root, text="心理测试结果 :")
             label.place(x=20, y=40)
             message = Message(self.root,
                               text="爱幻想,思维较感性,以是否与自己投缘为标准来选择朋友。性格显得较孤傲,有时较急噪,有时优柔寡断。事业心较强,喜欢有创造性的工作,不喜欢按常规办事。性格倔强,言语犀利,不善于妥协。崇尚浪漫的爱情,但想法往往不切合实际。金钱欲望一般")
             message.pack()
         elif score > 70 :
             label = Message(self.root, text="心理测试结果 :")
             label.place(x=20, y=40)
             message = Message(self.root,
                               text="好奇心强,喜欢冒险,人缘较好。事业心一般,对待工作,随遇而安,善于妥协。善于发现有趣的事情,但耐心较差,敢于冒险,但有时较胆小。渴望浪漫的爱情,但对婚姻的要求比较现实。不善理财。")
             message.pack()
         elif score >40:
             label = Message(self.root, text="心理测试结果 :")
             label.place(x=20, y=40)
             message = Message(self.root,
                               text="性情温良,重友谊,性格塌实稳重,但有时也比较狡黠。事业心一般,对本职工作能认真对待,但对自己专业以外事物没有太大兴趣,喜欢有规律的工作和生活,不喜欢冒险,家庭观念强,比较善于理财。")
             message.pack()
         else:
             label = Message(self.root, text="心理测试结果 :")
             label.place(x=20, y=40)
             message = Message(self.root,
                               text="散漫,爱玩,富于幻想。聪明机灵,待人热情,爱交朋友,但对朋友没有严格的选择标准。事业心较差,更善于享受生活,意志力和耐心都较差,我行我素。有较好的异性缘,但对爱情不够坚持认真,容易妥协。没有财产观念。")
             message.pack()
Beispiel #4
0
def showDia():
    dlg = SimpleDialog(
        root,
        text='hello SimpleDialog',
        buttons=['Yes', 'No', 'cancel'],
        default=0,
    )
    # 执行对话框
    print dlg.go()
 def HelpInfo(self):
     SimpleDialog(self,
         text='Required fields are:\n'
         'Part Width & Length,\n'
         'Amount to Remove,\n'
         'and Feedrate\n'
         'Fractions can be entered in most fields',
         buttons=['Ok'],
         default=0,
         title='User Info').go()
Beispiel #6
0
    def Gameover(self):
        DIF = ["", "easy", "normal", "hard"]
        Message = SimpleDialog(self,
                               text="You get %d Points in %s mode, good job!" %
                               (self.Point, DIF[self.NowDif]),
                               buttons=["Yes"])

        self.IsGameOver = True

        return
Beispiel #7
0
def dbMenuOpenFile():
    fd = FileDialog.LoadFileDialog(root)
    filePath = fd.go()
    if filePath!=None:
        dotIndex = filePath.rfind('.')
        if dotIndex!=-1:
            ext = filePath.rsplit('.',1)
            if ext[1]=='db':
                loadTable(filePath)
            else:
                SimpleDialog.SimpleDialog(root,text='请选择sqlite数据库(*.db)文件,\n选择的文件无效.',buttons=['确定']).go()
Beispiel #8
0
    def process_tmpfile(self, name, ma_type, isnew):
        from SimpleDialog import *
        # Edit tmpfile
        # Prompt for saving changes
        # Try to read the results
        # Store in the database
        # If it is a new entry update the listbox

        try:
            self.edit_tmpfile()
        except "Edit failed":
            self.set_text("Edit failed")
            self.selection_clear()
# end try

        dialog = SimpleDialog(self.root,
                              text="Save edits?",
                              buttons=["Yes", "No"])
        status = dialog.go()

        if (status == 0):
            try:
                result = self.read_tmpfile(ma_type)
            except "Invalid type":
                return  # msg set in read_tmpfile
# end try

            try:
                rtdb_put(name, result, ma_type)
                self.set_text("%s edits saved" % name)
            except NWChemError:
                self.set_text("%s save failed!" % name)
# end try
            if (isnew):
                # end if
                # end if
                # end def process_tmpfile
                n = 0
                try:
                    while (name > self.listbox.get(n)):
                        n = n + 1
                # end while
                except:
                    pass
                # end try
                self.listbox.insert(n, name)
                self.listbox.see(n)
        else:
            self.set_text("%s nothing saved" % name)

        self.selection_clear()
Beispiel #9
0
 def help(self):
     from SimpleDialog import *
     dialog = SimpleDialog(
         self.root,
         text="Quit \t- immediately exits.\n"
         "Delete \t- deletes selected entry.\n"
         "Edit \t- edits selected entry, optional save.\n"
         "New \t- makes new entry, prompts for type+name.\n"
         "Help \t- this is all that there is.\n"
         "\n"
         "Single click on item to select it.\n"
         "Double click on item to edit it.\n"
         "\n"
         "When editing\n"
         "\t- enter one value per line.\n"
         "\t- use true/false for logicals.\n"
         "\t- use 'e' in floating point exponents.\n"
         "\t- character strings are terminated at EOL.",
         buttons=["Done"])
     dialog.go()
Beispiel #10
0
    def sendCmd(self, cmdStr, doConfirm=False):
        """Send an arbitrary command to the alerts actor
        
        Inputs:
        - cmdStr
        """
        if doConfirm:
            dialog = SimpleDialog.SimpleDialog(self,
                                               text="Really %s?" % (cmdStr, ),
                                               buttons=["Yes", "No"],
                                               default=0,
                                               cancel=1,
                                               title="Test Dialog")
            if dialog.go() > 0:
                return

        cmdVar = opscore.actor.keyvar.CmdVar(
            actor="alerts",
            cmdStr=cmdStr,
            timeLim=CmdTimeLimit,
        )
        self.statusBar.doCmd(cmdVar)
Beispiel #11
0
def aboutMenu():
    dlg = SimpleDialog.SimpleDialog(root,text='    三国霸天传数据编辑工具\nprogrammer:viperasi\nweb-site:http://www.xu81.com',buttons=['确定'])
    dlg.go()
Beispiel #12
0
# -*- coding=utf8 -*-
from Tkinter import *
# 引入SimpleDialog模态对话框
from SimpleDialog import *

root = Tk()
# 创建一个SimpleDialog
# buttons:显示的按钮
# default:默认选中的按钮
dlg = SimpleDialog(
    root,
    text='你有未选择的题目!',
    buttons=['确定'],
    default=0,
)
# 执行对话框
dlg.go()
root.mainloop()