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


Python Tkinter.CENTER属性代码示例

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


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

示例1: _draw_node

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import CENTER [as 别名]
def _draw_node(self, coord, data_node):
        """Create a token for the data_node at the given coordinater"""
        (x,y) = coord
        data = self.dataG.node[data_node]

        # Apply filter to node to make sure we should draw it
        for filter_lambda in self._node_filters:
            try:
                draw_flag = eval(filter_lambda, {'u':data_node, 'd':data})
            except Exception as e:
                self._show_filter_error(filter_lambda, e)
                return
            # Filters are applied as an AND (ie, all must be true)
            # So if one is false, exit
            if draw_flag == False:
                return

        # Create token and draw node
        token = self._NodeTokenClass(self, data, data_node)
        id = self.create_window(x, y, window=token, anchor=tk.CENTER,
                                  tags='node')
        self.dispG.add_node(id, {'dataG_id': data_node,
                                 'token_id': id, 'token': token})
        return id 
开发者ID:jsexauer,项目名称:networkx_viewer,代码行数:26,代码来源:graph_canvas.py

示例2: add_span

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import CENTER [as 别名]
def add_span(self):
        for widget in self.displace_widget:
            widget.destroy()
        del self.displace_widget[:]
        if self.e_span.get()=='' or self.e_I.get()=='':
            pass
        else:
            self.lb_spans.insert(tk.END,self.e_span.get())
            self.lb_I.insert(tk.END,self.e_I.get())
        if self.e_span.get()=='' or self.lb_spans.size()==1:
            self.load_span.set(1)
            self._reset_option_menu([1])
        else:
            self._reset_option_menu(range(1,self.lb_spans.size()+1))
        
        for i in range(0,self.lb_spans.size()+1):
            self.displace_widget.append(tk.Entry(self.main_frame,width = 5, justify=tk.CENTER))
            self.displace_widget[i].insert(tk.END, '0.0')
            self.displace_widget[i].grid(row=11,column=5+i, padx= 2)
        
        if self.cant_in.get() == 'L' or self.cant_in.get() == 'B':
            self.displace_widget[0].configure(state="disabled")
            self.displace_widget[0].delete(0,tk.END)
            self.displace_widget[0].insert(tk.END, '0.0')
        else:
            self.displace_widget[0].configure(state="normal")
        
        if self.cant_in.get() == 'R' or self.cant_in.get() == 'B':
            self.displace_widget[-1].configure(state="disabled")
            self.displace_widget[-1].delete(0,tk.END)
            self.displace_widget[-1].insert(tk.END, '0.0')
        else:
            self.displace_widget[-1].configure(state="normal")
        
            
        self.ins_validate() 
开发者ID:buddyd16,项目名称:Structural-Engineering,代码行数:38,代码来源:beam_patterning.py

示例3: draw_static_beam_mouse

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import CENTER [as 别名]
def draw_static_beam_mouse(self, event, *args):
        w = self.g_beam_canvas.winfo_width()
        h = self.g_beam_canvas.winfo_height()

        if self.static_run == 1:
            self.g_beam_canvas.delete(self.val_at_x)
            self.g_beam_canvas.delete(self.val_at_x_text)
            initial = 25

            sf = self.static_beam_x_sf

            ll = self.ll
            lc = self.lc
            lr = self.lr

            x_screen = event.x
            x = x_screen - initial

            if x > (ll*sf) and x < ((ll+lc) * sf):
                x_anal = (x/sf) - ll

                v,m = self.simple_beam_ultimate_analysisx(x_anal)

                self.val_at_x_text = self.g_beam_canvas.create_text(w/2.0, (h-26), justify=tk.CENTER, text= '@ Xc = {0:.2f} ft\nVu:{1:.2f} kips\nMu:{2:.2f} ft-kips'.format(x_anal,v[1],m[1]))
            elif x > ((ll+lc)*sf):
                x_anal = (x/sf) - (ll+lc)

                if x_anal > lr:
                    pass
                else:
                    v,m = self.simple_beam_ultimate_analysisx(x_anal)

                    self.val_at_x_text = self.g_beam_canvas.create_text(w/2.0, (h-26), justify=tk.CENTER, text= '@ Xr = {0:.2f} ft\nVu:{1:.2f} kips\nMu:{2:.2f} ft-kips'.format(x_anal,v[2],m[2]))
            else:
                x_anal = x/sf
                if x_anal < 0:
                    pass
                else:
                    v,m = self.simple_beam_ultimate_analysisx(x_anal)

                    self.val_at_x_text = self.g_beam_canvas.create_text(w/2.0, (h-26), justify=tk.CENTER, text= '@ Xl = {0:.2f} ft\nVu:{1:.2f} kips\nMu:{2:.2f} ft-kips'.format(x_anal,v[0],m[0]))

            self.val_at_x = self.g_beam_canvas.create_line(x_screen, 0,x_screen,h,fill="blue", width=1, dash=(6,6))


        else:
            pass 
开发者ID:buddyd16,项目名称:Structural-Engineering,代码行数:49,代码来源:strap_beam_gui.py

示例4: draw_static_beam_mouse

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import CENTER [as 别名]
def draw_static_beam_mouse(self, event, *args):
        w = self.bm_canvas.winfo_width()
        h = self.bm_canvas.winfo_height()

        self.bm_canvas.delete(self.val_at_x)
        self.bm_canvas.delete(self.val_at_x_text)
        initial = 50

        sf = self.canvas_scale_x

        ll = float(self.left_cant_ft.get())
        lc = float(self.span_ft.get())
        lr = float(self.right_cant_ft.get())

        x_screen = event.x
        x = x_screen - initial

        E = float(self.E_ksi.get()) * (1/1000) * (1/math.pow(0.001,2))       #convert Mpa = N/mm^2 to kN/m^2
        I = float(self.I_in4.get()) * (math.pow(0.001,4))                   #covert from mm^4 to m^4

        text_color = 'yellow'

        if x > (ll*sf) and x < ((ll+lc) * sf):
            x_anal = (x/sf) - ll

            v,m,s,d = self.analysisx(x_anal)

            self.val_at_x_text = self.bm_canvas.create_text(w/2.0, (h-26), justify=tk.CENTER, text= '@ Xc = {0:.2f} m\nV: {1:.2f} kN  M: {2:.2f} kN*m  S: {3:.3E} rad  D: {4:.3E} mm'.format(x_anal,v[1],m[1],s[1]/(E*I),(d[1]/(E*I))*1000.0), fill=text_color)

        elif x > ((ll+lc)*sf):
            x_anal = (x/sf) - (ll+lc)

            if x_anal > lr:
                pass
            else:
                v,m,s,d = self.analysisx(x_anal)

                self.val_at_x_text = self.bm_canvas.create_text(w/2.0, (h-26), justify=tk.CENTER, text= '@ Xr = {0:.2f} m\nV: {1:.2f} kN  M: {2:.2f} kN*m  S: {3:.3E} rad  D: {4:.3E} mm'.format(x_anal,v[2],m[2],s[2]/(E*I),(d[2]/(E*I))*1000.0), fill=text_color)
        else:
            x_anal = x/sf
            if x_anal < 0:
                pass
            else:
                v,m,s,d = self.analysisx(x_anal)

                self.val_at_x_text = self.bm_canvas.create_text(w/2.0, (h-26), justify=tk.CENTER, text= '@ Xl = {0:.2f} m\nV: {1:.2f} kN  M: {2:.2f} kN*m  S: {3:.3E} rad  D: {4:.3E} mm'.format(x_anal,v[0],m[0],s[0]/(E*I),(d[0]/(E*I))*1000.0), fill=text_color)

        self.val_at_x = self.bm_canvas.create_line(x_screen, 0,x_screen,h,fill="blue", width=1, dash=(6,6)) 
开发者ID:buddyd16,项目名称:Structural-Engineering,代码行数:50,代码来源:simple_beam_metric.py

示例5: draw_static_beam_mouse

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import CENTER [as 别名]
def draw_static_beam_mouse(self, event, *args):
        w = self.bm_canvas.winfo_width()
        h = self.bm_canvas.winfo_height()

        self.bm_canvas.delete(self.val_at_x)
        self.bm_canvas.delete(self.val_at_x_text)
        initial = 50

        sf = self.canvas_scale_x

        ll = float(self.left_cant_ft.get())
        lc = float(self.span_ft.get())
        lr = float(self.right_cant_ft.get())

        x_screen = event.x
        x = x_screen - initial

        E = float(self.E_ksi.get()) * 144        #144 is conversion from ksi to ksf - 12^2
        I = float(self.I_in4.get()) / 12.0**4    #covert from in^4 to ft^4

        text_color = 'yellow'

        if x > (ll*sf) and x < ((ll+lc) * sf):
            x_anal = (x/sf) - ll

            v,m,s,d = self.analysisx(x_anal)

            self.val_at_x_text = self.bm_canvas.create_text(w/2.0, (h-26), justify=tk.CENTER, text= '@ Xc = {0:.2f} ft\nV: {1:.2f} kips  M: {2:.2f} ft-kips  S: {3:.5f} rad  D: {4:.4f} in'.format(x_anal,v[1],m[1],s[1]/(E*I),(d[1]/(E*I))*12.0), fill=text_color)

        elif x > ((ll+lc)*sf):
            x_anal = (x/sf) - (ll+lc)

            if x_anal > lr:
                pass
            else:
                v,m,s,d = self.analysisx(x_anal)

                self.val_at_x_text = self.bm_canvas.create_text(w/2.0, (h-26), justify=tk.CENTER, text= '@ Xr = {0:.2f} ft\nV: {1:.2f} kips  M: {2:.2f} ft-kips  S: {3:.5f} rad  D: {4:.4f} in'.format(x_anal,v[2],m[2],s[2]/(E*I),(d[2]/(E*I))*12.0), fill=text_color)
        else:
            x_anal = x/sf
            if x_anal < 0:
                pass
            else:
                v,m,s,d = self.analysisx(x_anal)

                self.val_at_x_text = self.bm_canvas.create_text(w/2.0, (h-26), justify=tk.CENTER, text= '@ Xl = {0:.2f} ft\nV: {1:.2f} kips  M: {2:.2f} ft-kips  S: {3:.5f} rad  D: {4:.4f} in'.format(x_anal,v[0],m[0],s[0]/(E*I),(d[0]/(E*I))*12.0), fill=text_color)

        self.val_at_x = self.bm_canvas.create_line(x_screen, 0,x_screen,h,fill="blue", width=1, dash=(6,6)) 
开发者ID:buddyd16,项目名称:Structural-Engineering,代码行数:50,代码来源:simple_beam.py


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