当前位置: 首页>>代码示例>>Python>>正文


Python Tk.wait_window方法代码示例

本文整理汇总了Python中Tkinter.Tk.wait_window方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.wait_window方法的具体用法?Python Tk.wait_window怎么用?Python Tk.wait_window使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tkinter.Tk的用法示例。


在下文中一共展示了Tk.wait_window方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: show_message

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import wait_window [as 别名]
def show_message(msg):
    try:
        from Tkinter import Label,Tk,Button,Toplevel
        class MyDialog:
            def __init__(self, parent):
                top = self.top = Toplevel(parent)
                Label(top, text=msg).pack()
                b = Button(top, text="OK", command=self.ok)
                b.pack(pady=5)
            def ok(self):
                self.top.destroy()
        root = Tk()
        Button(root, text="OK!").pack()
        root.update()

        d = MyDialog(root)

        root.wait_window(d.top)
    except:pass
开发者ID:Dbartes,项目名称:garenahon,代码行数:21,代码来源:launcher.py

示例2: TkApplicationWindow

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import wait_window [as 别名]

#.........这里部分代码省略.........
        pass
        
    def exit_gui(self):
        try:
            self.root.destroy()
        except:
            pass

    def confirm_exit(self):
        return tkMessageBox.askyesno("Exit Llia", "Exit Llia?")
        
    def exit_app(self):
        self.app.exit_()

    def as_widget(self):
        return self.root
        
    def status(self, msg):
        self._lab_status.config(text=str(msg))

    def warning(self, msg):
        msg = "WARNING: %s" % msg
        self._lab_status.config(text=msg)
        
    def clear_status(self):
        self.status("")
                                              
    def start_gui_loop(self):
        self.root.mainloop()

    def show_about_dialog(self):
        from llia.gui.tk.tk_about_dialog import TkAboutDialog
        dialog = TkAboutDialog(self.root, self.app)
        self.root.wait_window(dialog)

    def display_help(self, topic=None):
        pass
        
    def show_history_editor(self):
        from llia.gui.tk.tk_history import TkHistoryEditor
        dialog = TkHistoryEditor(self.root, self.app)
        self.root.wait_window(dialog)

    def ping_global(self):
        try:
            rs = self.app.proxy.ping()
            if rs:
                self.status("Ping OK")
            else:
                self.warning("Ping Error")
        except LliaPingError as err:
            self.warning(err.message)

    def toggle_osc_trace(self):
        LliaProxy.trace = not LliaProxy.trace
        if LliaProxy.trace:
            self.status("OSC transmission trace enabled")
        else:
            self.status("OSC transmission trace disabled")

    def show_channel_name_dialog(self):
        from llia.gui.tk.tk_channel_name_editor import TkChannelNameEditor
        dialog = TkChannelNameEditor(self.root, self.app)
        self.root.wait_window(dialog)
  
    def show_controller_name_dialog(self):
开发者ID:plewto,项目名称:Llia,代码行数:70,代码来源:tk_appwindow.py

示例3: GameButton

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import wait_window [as 别名]
        currentMove = self.v
        self.top.destroy()

class GameButton():
    def __init__(self, i, master=None):
        self.numara = i
        self.satir = i / 3
        self.sutun = i % 3
        self.metin = StringVar()
        self.metin.set("")
        def clicked():
            player(self.numara)
        self.gorunum = Button(root, command=clicked, bg='gray', width=200, height=150, image=renksizAdam)
        self.gorunum.grid(row=self.satir, column=self.sutun)

root = Tk()
root.wait_window(WhichColor(root).top)
root.title('XOX Graphical Interface')

menubar = Menu(root)
menubar.add_command(label="NEW GAME", command=startGame)
menubar.add_command(label="POINTS", command=points)
menubar.add_command(label="EXIT", command=root.quit)

root.config(menu=menubar)
renksizAdam = ImageTk.PhotoImage(file="RenksizAdam.png")
yesilAdam = ImageTk.PhotoImage(file="YesilAdam.png")
sariAdam = ImageTk.PhotoImage(file="SariAdam.png")
startGame()
mainloop()
开发者ID:tekrei,项目名称:PythonExamples,代码行数:32,代码来源:pyXOXPlayer.py

示例4: combineTS

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import wait_window [as 别名]
        # combine all the TS files then delete the individual files downloaded
        if (chkboxCombine == True):
            combineTS()

        endingTime = datetime.datetime.now()
        delta = endingTime - starterTime
        print 'ripTS was successful Enjoy!'
        print "ripTS took: " ,delta
    except KeyboardInterrupt:
        print "Shutdown requested...exiting"
    except Exception:
        traceback.print_exc(file=sys.stdout)
    sys.exit(0)

def init(args): #for multiprocessing
    global counter
    counter = args

if __name__ == '__main__':
    root = Tk() # Tk Dialogue
    root.geometry("300x200+300+300")
    popup = MyDialog(root) # Tk Dialogue
    root.wait_window(popup.top) # Tk Dialogue
    m = re.search('.m3u8', userInputURL)
    if m is None:
        print "[!Error!] Bad URL please check your URL for m3u8 file [!Error!]"
    else:
        print "Starting ripTS"
        start()  # Start download and combine TS Files
开发者ID:KeperTech,项目名称:ripts,代码行数:31,代码来源:ripTS-MP-with-Tkinter-0.3.py

示例5: zfitwin

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import wait_window [as 别名]

#.........这里部分代码省略.........
            # find the current width in x
            currentwidth = self.spectrumPlot_prop["xmax"] - self.spectrumPlot_prop["xmin"]
            # pan left
            self.spectrumPlot_prop["xmin"] = self.spectrumPlot_prop["xmin"] - currentwidth / 2
            self.spectrumPlot_prop["xmax"] = self.spectrumPlot_prop["xmax"] - currentwidth / 2
            self.update_spectrum(update=True)
            # update 2d spectra accordingly
            self.update_twodspec(update=True)
            self.update_twoderr(update=True)

        # pan right
        if event.key == "]":
            # find the current width in x
            currentwidth = self.spectrumPlot_prop["xmax"] - self.spectrumPlot_prop["xmin"]
            # pan right
            self.spectrumPlot_prop["xmin"] = self.spectrumPlot_prop["xmin"] + currentwidth / 2
            self.spectrumPlot_prop["xmax"] = self.spectrumPlot_prop["xmax"] + currentwidth / 2
            self.update_spectrum(update=True)
            # update 2d spectra accordingly
            self.update_twodspec(update=True)
            self.update_twoderr(update=True)
        # set reset plot
        if event.key == "W":
            self.spectrumPlot_prop["xmin"] = np.min(np.nan_to_num(self.fitwav1d))
            self.spectrumPlot_prop["xmax"] = np.max(np.nan_to_num(self.fitwav1d))
            self.spectrumPlot_prop["ymin"] = np.min(np.nan_to_num(self.fitspe1d))
            self.spectrumPlot_prop["ymax"] = np.max(np.nan_to_num(self.fitspe1d))
            self.update_spectrum(update=True)
            # update 2d spectra accordingly
            self.update_twodspec(update=True)
            self.update_twoderr(update=True)
        # smooth plot
        if event.key == "S":
            self.fitspe1d = signal.medfilt(self.fitspe1d, self.smooth)
            self.smooth = self.smooth + 2
            self.update_spectrum(update=True)

        # unsmooth smooth
        if event.key == "U":
            self.fitspe1d = self.fitspe1d_original
            self.smooth = 3
            self.update_spectrum(update=True)

    def lineselectorwidget(self, event):
        """  Control what happens when right-click on 1D spectrum 
        
             - trigger construction of line list selector
        
        """

        # refresh lines as needed
        self.displaylines()

        # lounch a new window
        self.lnsel = Tkinter.Toplevel(self.tk)

        # pick z
        try:
            redsh = float(self.redshiftline.get())
        except:
            redsh = 0.0

        # create line buttons for those visibles
        self.wlineselect = Tkinter.DoubleVar()
        self.wlinepos = event.xdata
        i = 0
        for lw, lnam in self.infoline:
            lwplot = lw * (1 + redsh)
            Tkinter.Radiobutton(
                self.lnsel,
                text=lnam + "{}".format(int(lw)),
                variable=self.wlineselect,
                value=lw,
                command=self.pickedline,
            ).grid(row=i % 30, column=i / 30, sticky="NWSE")
            i = i + 1

        self.tk.wait_window(self.lnsel)

    def pickedline(self):

        """ If one pick a line, find redshift """

        # find the redshift
        redshift = self.wlinepos / self.wlineselect.get() - 1

        # set it - auto trigger refresh
        self.shwlinstate.set(1)
        self.redshiftline.set("{}".format(redshift))

        # destroy window
        self.lnsel.destroy()

    def gauss(self, x, *p):
        """ Gaussian model for line fit """

        A, mu, sigma, zero = p
        gg = A * np.exp(-1.0 * (x - mu) * (x - mu) / (2.0 * sigma * sigma)) + zero

        return gg
开发者ID:mifumagalli,项目名称:mypython,代码行数:104,代码来源:zfit.py


注:本文中的Tkinter.Tk.wait_window方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。