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


Python Frame.quit方法代码示例

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


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

示例1: quit

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import quit [as 别名]
 def quit( self ):
     "Stop everything and quit."
     self.stop( wait=False)
     Frame.quit( self )
开发者ID:1514louluo,项目名称:mininet,代码行数:6,代码来源:consoles.py

示例2: quit

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import quit [as 别名]
 def quit( self ):
     "Stop our network, if any, then quit."
     self.stop()
     Frame.quit( self )
开发者ID:adityagawade27,项目名称:LoadBalancer,代码行数:6,代码来源:myminiedit.py

示例3: closeAll

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import quit [as 别名]
 def closeAll(self):
     Frame.quit(self)
开发者ID:belargej,项目名称:PythonProjects,代码行数:4,代码来源:Walk_2d.py

示例4: __init__

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

#.........这里部分代码省略.........
            HEIGHT = XTRACTAB[index]['HEIGHT']
            B_BKG1 = XTRACTAB[index]['B_BKG1'] + offset
            B_BKG2 = XTRACTAB[index]['B_BKG2'] + offset
            BHEIGHT = XTRACTAB[index]['BHEIGHT']

            plt.axhspan(
                B_SPEC - (HEIGHT - 1) / 2,
                B_SPEC + (HEIGHT - 1) / 2,
                facecolor='0.5',
                alpha=0.4)
            plt.axhspan(
                B_BKG1 - (BHEIGHT - 1) / 2,
                B_BKG1 + (BHEIGHT - 1) / 2,
                facecolor='0.2',
                alpha=0.4)
            plt.axhspan(
                B_BKG2 - (BHEIGHT - 1) / 2,
                B_BKG2 + (BHEIGHT - 1) / 2,
                facecolor='0.2',
                alpha=0.4)

        if self.show_spectrum.get():
            sample = pyfits.open('lbp102neq_corrtag_a.fits')
            im = ttag_image(sample[1].data)
            # plt.imshow(im,cmap=plt.get_cmap('gist_yarg'),aspect='auto',interpolation='nearest',alpha=.7)

        if self.xmin.get() != 'ALL' and self.xmax.get() != 'ALL':
            plt.xlim(int(self.xmin.get()), int(self.xmax.get()))
        if self.ymin.get() != 'ALL' and self.ymax.get() != 'ALL':
            plt.ylim(int(self.ymin.get()), int(self.ymax.get()))
        self.canvas.show()

    def exit(self):
        self.myContainer.quit()
        sys.exit(1)

    def extract_dqs(self):
        plt.figure(1)
        plt.subplot(1, 1, 1)
        xlim_a = (1200, 15099)
        ylim_a = (335, 699)
        xlim_b = (950, 15049)
        ylim_b = (400, 749)
        seg = self.segment.get()
        if seg == 'A':
            xlim = xlim_a
            ylim = ylim_a
        elif seg == 'B':
            xlim = xlim_b
            ylim = ylim_b
        dq_array = numpy.zeros((1024, 16384), int)
 
        seg = self.segment.get()
        bpix = pyfits.open('bpix.fits')
        for line in bpix[1].data:
            if line[0] == 'FUV' + seg:
                lx = line['LX']
                ly = line['LY']
                dx = line['DX'] - 1  # width, not delta
                dy = line['DY'] - 1
                dq = line['DQ']
                subarray = dq_array[ly:ly + dy, lx:lx + dx]
                index = numpy.where(subarray != dq)
                dq_array[ly:ly + dy, lx:lx + dx][index] += dq
  
        # plt.contourf(dq_array,aspect='auto',levels=[0,2,4,8,16,32,64,128,256])
开发者ID:justincely,项目名称:astroraf,代码行数:70,代码来源:cosview.py

示例5: App

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import quit [as 别名]
class App():

    def __init__(self, robot, playground, canvas_size=600,
                 storage=BACKUP_DIR):

        self.robot = robot
        self.playground = playground
        self.robot.bound_to_palyground(playground)

        self.storage = storage

        self.master = Tk()
        self.canvas_size = canvas_size

        self.frame = Frame(self.master)
        self.frame.grid(row=0)

        self.canvas = Canvas(self.master, width=canvas_size, height=canvas_size,
                             borderwidth=2, highlightthickness=1)
        self.canvas.grid(row=1, columnspan=4)
        robot_states.append(ImageTk.PhotoImage(ARROW.copy()))

        # display & edit robot coordinates
        self.txt = Entry(self.master)
        self.txt.grid(row=3, column=2, sticky=NW)

        import_button = Button(self.master, text="edit robot position",
                               command=self.edit_robot_position)
        import_button.grid(row=3, column=2, sticky=NE)

        # start button
        import_button = Button(self.master, text="start", command=self.start_thread)
        import_button.grid(row=2, column=0, sticky=NW)

        # pause button
        import_button = Button(self.master, text="pause", command=self.pause_thread)
        import_button.grid(row=2, column=1, sticky=NW)

        # stop button
        import_button = Button(self.master, text="stop", command=self.end_prog)
        import_button.grid(row=2, column=2, sticky=NW)

        # import button
        import_button = Button(self.master, text="import", command=self.import_state)
        import_button.grid(row=3, column=0, sticky=NW)

        # export button
        export_button = Button(self.master, text="export", command=self.export_state)
        export_button.grid(row=3, column=1, sticky=NW)

        self.draw()

    def start(self):
        self.master.mainloop()

    def set_client(self, client):
        self.client = client

    def start_thread(self):
        self.client.allow_working.set()
        if not self.client.is_alive():
            self.client.start()

    def pause_thread(self):
        self.client.allow_working.clear()

    def end_prog(self):
        self.client.stop()
        self.frame.quit()

    def edit_robot_position(self):
        def is_valid(pos):
            if len(pos) != 3:
                return False
            else:
                return True

        pos = tuple(float(v) for v in re.findall("[0-9]+[.][0-9]+|[0-9]+", self.txt.get()))

        if is_valid(pos):
            self.robot.set_position(pos)
            self.draw()

    def export_state(self):
        data = {'robot': self.robot.__dict__,
                'playground': self.playground.to_dict()}
        file_name = str(datetime.now()) + ".json"
        _file = open(pt.join(self.storage, file_name), 'w')
        _file.write(json.dumps(data, indent=4))

    def import_state(self):
        file_name = askopenfilename(parent=self.master)
        data = json.load(open(file_name))
        self.robot = Robot.from_dict(data['robot'])
        self.playground = PlayGround.from_dict(data['playground'])

    def draw(self):
        scale = self.canvas_size / self.playground.grid.shape[0]
        for row in self.playground.grid:
            for cell in row:
#.........这里部分代码省略.........
开发者ID:myaser,项目名称:sweeper,代码行数:103,代码来源:gui.py

示例6: quit

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import quit [as 别名]
 def quit(self):
     ans = askokcancel("Verify exit", "Are you sure you want to quit ?")
     if ans:
         Frame.quit(self)
开发者ID:PyPoS,项目名称:PyPoS,代码行数:6,代码来源:quitter.py


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