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


Python Tk.attributes方法代码示例

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


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

示例1: show

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import attributes [as 别名]
 def show(text, background="#fff", timeout_ms=DEFAULT_TIMEOUT, font_size=100):
     root = Tk()
     root.attributes("-topmost", True)
     root.lift()
     # Set Timeout
     root.after(timeout_ms, root.destroy)
     # Create Frame
     frame = Frame(root)
     frame.pack(side=TOP, fill=BOTH, expand=YES)
     # Set frame size and position
     screen_width = frame.master.winfo_screenwidth()
     screen_heigh = frame.master.winfo_screenheight()
     w = screen_width * 0.8
     h = screen_heigh * 0.6
     # Center the window
     x = (screen_width/2) - (w/2)
     y = (screen_heigh/2) - (h/2)
     frame.master.geometry('%dx%d+%d+%d' % (w, h, x, y))
     # Adjust frame properties
     frame.master.overrideredirect(True)  # Set no border or title
     frame.config(bg=background)
     # Create text label
     label = Label(frame, text=text, wraplength=screen_width * 0.8)
     label.pack(side=TOP, expand=YES)
     label.config(bg=background, justify=CENTER, font=("calibri", font_size))
     # Set transparency
     root.wait_visibility(root)  # Needed for linux (and must come after overrideredirect)
     root.attributes('-alpha', 0.6)
     # Run Event loop
     root.mainloop()
开发者ID:eranbrodet,项目名称:NotiFire,代码行数:32,代码来源:screenSplasher.py

示例2: main

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import attributes [as 别名]
def main():
  
    root = Tk()
    root.geometry("300x300+300+300")
    root.attributes("-fullscreen", True)
    app = Example(root)
    root.mainloop()  
开发者ID:Pedro-M-Santos,项目名称:python_scripts,代码行数:9,代码来源:gui_v2.py

示例3: getLoadPath

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import attributes [as 别名]
def getLoadPath(directory, extension):
    if int(sys.version[0]) < 3:
        from tkFileDialog import askopenfilename
        from Tkinter import Tk
    else:
        from tkinter.filedialog import askopenfilename
        from tkinter import Tk
    master = Tk()
    master.attributes("-topmost", True)
    path = askopenfilename(initialdir=directory,filetypes=['vehicle {*.'+extension+'}'],title="Open")
    master.destroy()
    return path
开发者ID:arpruss,项目名称:raspberryjam-pe,代码行数:14,代码来源:vehicle.py

示例4: main

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import attributes [as 别名]
def main():

	root = Tk()
	def kludge():
		root.after(100, kludge)
	root.after(100, kludge)

	def handle_sigusr1(signum, frame):
		root.quit()
	signal.signal(signal.SIGUSR1, handle_sigusr1)

	root.geometry("250x150+300+300")
	root.attributes("-fullscreen", True)
	app = Example(root)
	root.mainloop()
	print("Here we are cleaning up.")
开发者ID:OrganDonor,项目名称:Organelle,代码行数:18,代码来源:tkdemo.py

示例5: get_files

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import attributes [as 别名]
def get_files(titlestring,filetype = ('.txt','*.txt')):
     
    # Make a top-level instance and hide since it is ugly and big.
    root = Tk()
    root.withdraw()
    
    # Make it almost invisible - no decorations, 0 size, top left corner.
    root.overrideredirect(True)
    root.geometry('0x0+0+0')
#    
    # Show window again and lift it to top so it can get focus,
    # otherwise dialogs will end up behind the terminal.
    root.deiconify()
    root.attributes("-topmost",1)
    root.focus_force()

    filenames = []
     
    filenames = tkFileDialog.askopenfilename(title=titlestring, filetypes=[filetype],multiple='True')
    
    #do nothing if already a python list
    if filenames == "": 
        print "You didn't open anything!"  
        return
    
    root.destroy()
    
    if isinstance(filenames,list):
        result = filenames   
    elif isinstance(filenames,tuple): 
        result = list(filenames)
    else:
        #http://docs.python.org/library/re.html
        #the re should match: {text and white space in brackets} AND anynonwhitespacetokens
        #*? is a non-greedy match for any character sequence
        #\S is non white space
    
        #split filenames string up into a proper python list
        result = re.findall("{.*?}|\S+",filenames)
    
        #remove any {} characters from the start and end of the file names
        result = [ re.sub("^{|}$","",i) for i in result ] 
    result.sort()
    return result
开发者ID:dashamstyr,项目名称:LNCcode,代码行数:46,代码来源:LNC_tools.py

示例6: display

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import attributes [as 别名]
def display(image_file):
    
    root = Tk()
    root.title("Dataflow Graph")
    screen_width=root.winfo_screenwidth()*1.0
    screen_height=root.winfo_screenheight()*0.875
    
    image1 = Image.open(image_file)
    width,height=image1.size
    if width>screen_width or height>screen_height:
        factor=max(width/screen_width,height/screen_height)
        image1=image1.resize((int(width/factor),int(height/factor)), Image.ANTIALIAS)

    
    frame = Frame(root, width=image1.size[0],height=image1.size[1])
    frame.grid(row=0,column=0)
    canvas=Canvas(frame,bg='#FFFFFF',width=image1.size[0],height=image1.size[1],scrollregion=(0,0,image1.size[0],image1.size[1]))
    img = ImageTk.PhotoImage(image1)
    canvas.create_image(0,0,image=img, anchor="nw")

    hbar=Scrollbar(frame,orient=HORIZONTAL)
    hbar.pack(side=BOTTOM,fill=Tkinter.X)
    hbar.config(command=canvas.xview)
    vbar=Scrollbar(frame,orient=VERTICAL)
    vbar.pack(side=RIGHT,fill=Tkinter.Y)
    vbar.config(command=canvas.yview)
    canvas.config(width=image1.size[0],height=image1.size[1])
    canvas.config(xscrollcommand=hbar.set, yscrollcommand=vbar.set)
    canvas.pack(side=LEFT,expand=True,fill=BOTH)

    frame.pack()
    # added so that the windows pops up (and is not minimized) 
    # --> see http://stackoverflow.com/questions/9083687/python-tkinter-gui-always-loads-minimized
    root.attributes('-topmost', 1)
    root.update()
    root.attributes('-topmost', 0)    
    mainloop()
开发者ID:istoney,项目名称:eucliddatasimulator,代码行数:39,代码来源:visualizer.py

示例7: UI

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import attributes [as 别名]
class UI(object):
    def __init__(self):
        self._root = Tk()
        self._root.title("^ NotiFire ^")
        self._name = StringVar()
        self._is_osx = which_system() == 'Darwin'
        self._version = None

    ##########################################################################
    ####                       Public methods                            #####
    ##########################################################################
    def get_name(self):
        frame = DraggableFrame(self._root)
        frame.pack(side=TOP, fill=BOTH, expand=YES)

        frame.columnconfigure(0, weight=1)
        frame.columnconfigure(4, weight=1)
        frame.rowconfigure(0, weight=1)
        frame.rowconfigure(4, weight=1)

        w = self._set_frame_geo(frame, 0.3, 0.3)[2]
        self._set_x_button(frame, w, self._close_get_name)
        Label(frame, text="Name:").grid(column=1, row=1)
        entry_style = SUNKEN if self._is_osx else FLAT
        entry = Entry(frame, exportselection=0, relief=entry_style, textvariable=self._name)
        entry.grid(column=2, row=1)
        entry.focus_set()
        error_label = Label(frame, fg='red')
        error_label.grid(column=1, row=2, columnspan=3)

        ok_cmd = partial(self._validate_name, error_label)
        FlatButton(frame, text='OK', width=20, font=("calibri", 15),
                   command=ok_cmd).grid(column=1, row=3, columnspan=3)

        self._root.bind('<Return>', ok_cmd)
        self._root.bind('<Escape>', self._close_get_name)
        self._run()
        return self._name.get() if self._name else self._name

    def main_window(self, name, ping_callback):
        self._name.set(name)
        self._ping_callback = ping_callback

        # Create Frame
        self.frame = DraggableFrame(self._root)
        self.frame.pack(side=TOP, fill=BOTH, expand=YES)

        w = self._set_frame_geo(self.frame, 0.5, 0.6)[2]

        self._set_x_button(self.frame, w, self._root.destroy)
        Label(self.frame, text="Name:").place(x=10, y=15)
        Label(self.frame, text=self._name.get(), fg='blue').place(x=80, y=15)
        self._version_label = Label(self.frame, text="Newer version detected, please restart the app", fg='#a00', font=("calibri", 25))

        FlatButton(self.frame, text="Test", width=26, command=self._test_action).place(x=10, y=50)
        FlatButton(self.frame, text='Refresh', width=26, command=self._generate_ping_buttons).place(x=10, y=90)
        self.ping_buttons = []
        self._auto_refresh()
        self._check_version()
        self._run()

    ##########################################################################
    ####                       Private methods                           #####
    ##########################################################################
    def _run(self):
        # Set transparency
        self._root.wait_visibility(self._root)
        self._root.attributes('-alpha', 0.95)
        self._root.lift()
        # Run Event loop
        self._root.mainloop()

    def _close_get_name(self, event=None):
        self._name = None
        self._root.destroy()

    def _set_frame_geo(self, frame, wf, hf):
        # Set frame size and position
        screen_width = frame.master.winfo_screenwidth()
        screen_heigh = frame.master.winfo_screenheight()
        w = screen_width * wf
        h = screen_heigh * hf
        # Center the window
        x = (screen_width/2) - (w/2)
        y = (screen_heigh/2) - (h/2)
        frame.master.geometry('%dx%d+%d+%d' % (w, h, x, y))
        if not self._is_osx:
            frame.master.overrideredirect(True)  # Set no border or title
        return x, y, w, h

    def _set_x_button(self, frame, w, callback):
        x_button_x_coordinate = w-30 if self._is_osx else w-20
        FlatButton(frame, text='×', no_bg=True, width=1, font=("calibri", 15), command=callback).place(x=x_button_x_coordinate, y=-10)

    def _validate_name(self, error_label, event=None):
        name = self._name.get()
        if not 0 < len(name) < 25:
            error_label.config(text="Name must be 1-25 chars long")
            logger.error("Invalid name: %s" % (name))
        elif not all(ord(c) < 128 for c in name):
#.........这里部分代码省略.........
开发者ID:eranbrodet,项目名称:NotiFire,代码行数:103,代码来源:mainUI.py

示例8: PiPresents

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

#.........这里部分代码省略.........
            call(["xset","s", "off"])
            call(["xset","s", "-dpms"])

        self.root=Tk()   
       
        self.title='Pi Presents - '+ self.pp_profile
        self.icon_text= 'Pi Presents'
        self.root.title(self.title)
        self.root.iconname(self.icon_text)
        self.root.config(bg=self.starter_show['background-colour'])

        self.mon.log(self, 'monitor screen dimensions are ' + str(self.root.winfo_screenwidth()) + ' x ' + str(self.root.winfo_screenheight()) + ' pixels')
        if self.options['screensize'] =='':        
            self.screen_width = self.root.winfo_screenwidth()
            self.screen_height = self.root.winfo_screenheight()
        else:
            reason,message,self.screen_width,self.screen_height=self.parse_screen(self.options['screensize'])
            if reason =='error':
                self.mon.err(self,message)
                self.end('error',message)

        self.mon.log(self, 'forced screen dimensions (--screensize) are ' + str(self.screen_width) + ' x ' + str(self.screen_height) + ' pixels')
       
        # set window dimensions and decorations
        if self.options['fullscreen'] is False:
            self.window_width=int(self.root.winfo_screenwidth()*self.nonfull_window_width)
            self.window_height=int(self.root.winfo_screenheight()*self.nonfull_window_height)
            self.window_x=self.nonfull_window_x
            self.window_y=self.nonfull_window_y
            self.root.geometry("%dx%d%+d%+d" % (self.window_width,self.window_height,self.window_x,self.window_y))
        else:
            self.window_width=self.screen_width
            self.window_height=self.screen_height
            self.root.attributes('-fullscreen', True)
            os.system('unclutter &')
            self.window_x=0
            self.window_y=0  
            self.root.geometry("%dx%d%+d%+d"  % (self.window_width,self.window_height,self.window_x,self.window_y))
            self.root.attributes('-zoomed','1')

        # canvas cover the whole screen whatever the size of the window. 
        self.canvas_height=self.screen_height
        self.canvas_width=self.screen_width
  
        # make sure focus is set.
        self.root.focus_set()

        # define response to main window closing.
        self.root.protocol ("WM_DELETE_WINDOW", self.handle_user_abort)

        # setup a canvas onto which will be drawn the images or text
        self.canvas = Canvas(self.root, bg=self.starter_show['background-colour'])


        if self.options['fullscreen'] is True:
            self.canvas.config(height=self.canvas_height,
                               width=self.canvas_width,
                               highlightthickness=0)
        else:
            self.canvas.config(height=self.canvas_height,
                    width=self.canvas_width,
                        highlightthickness=1,
                               highlightcolor='yellow')
            
        self.canvas.place(x=0,y=0)
        # self.canvas.config(bg='black')
开发者ID:KenT2,项目名称:pipresents-gapless,代码行数:70,代码来源:pipresents.py

示例9: SpeakersCorner

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import attributes [as 别名]
class SpeakersCorner():

    def __init__(self):

        self.video_length = 90  # seconds
        self.button = 17

        # BCM (Broadcom SOC Channel) GPIO 17 is pin #11 on the board
        GPIO.setmode(GPIO.BCM)
        GPIO.setwarnings(False)
        GPIO.setup(self.button, GPIO.IN)

        self.window = Tk()
        self.window.attributes("-fullscreen", True)
        self.window.configure(cursor='none')

    def countdown(self):
        """
        Display countdown on LED matrix, updatingn in 10 second intervals
        Determines video recording length

        :return:
        """

        # Initialize display
        matrix = led.matrix()

        # Display message at beginning of recording.
        matrix.show_message("Seconds left:", font=proportional(CP437_FONT))
        time.sleep(1)  # Wait for message to display

        time_remaining = self.video_length
        while time_remaining > 0:
            matrix.show_message(str(time_remaining))
            time_remaining -= 10
            time.sleep(10)

    def parsegeometry(self, geometry):
        """
        Parses window geometry
        """

        x, y = geometry.split('+')[0].split('x')
        return (x, y)

    def poll_button(self):
        if (GPIO.input(self.button)):
            self.begin_recording()

        self.window.after(100, self.poll_button)

    def begin_recording(self):
        camera = picamera.PiCamera()

        camera.start_preview()

        time.sleep(10000)

        camera.stop_preview()

        # Start subprocess to record audio and video
        #pid = subprocess.Popen([
            #'/home/pi/picam-1.3.0-binary/picam',
            #'--alsadev',
            #'hw:1,0',
            #'--preview',
            #'--volume',
            #'2'
        #])

        #time.sleep(2)

         #use picam's start_record hook
        #self.touch('/home/pi/speakers-corner/hooks/start_record')

        #self.countdown()

        #time.sleep(1)

         #use picam's stop_record hook
        #self.touch('/home/pi/speakers-corner/hooks/stop_record')
        #time.sleep(2)

        #pid.kill()

        #self.remux_latest_video_file()

    def remux_latest_video_file(self):
        """
        Repackage the latest MPEG-TS (Transport Stream) file
        in an MPEG-PS (Program Stream) container
        """

        ts_file_dir = '/home/pi/speakers-corner/rec'
        #ts_file_dir = '/Users/jeffszusz/projects/hackf/speakerscorner/rec'

        (_, _, ts_files) = os.walk(ts_file_dir).next()

        ts_file_name = ts_files[-1]
        ts_file_path = os.path.join(ts_file_dir, ts_file_name)
#.........这里部分代码省略.........
开发者ID:hackf,项目名称:speakers_corner,代码行数:103,代码来源:speaker.py

示例10: __init__

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import attributes [as 别名]
class MyGUI:
  def __init__(self):
    self.__mainWindow = Tk()
    self.outdoor = True
    self.indoor = False
    self.RWidth=self.__mainWindow.winfo_screenwidth()
    self.RHeight=self.__mainWindow.winfo_screenheight()
    self.__mainWindow.geometry(("%dx%d")%(self.RWidth,self.RHeight))
    self.__mainWindow.maxsize(width=480, height=320)
    self.__mainWindow.attributes("-fullscreen", True)
    self.but_frame = Frame(self.__mainWindow, pady=5, padx=5,  height=60, width=self.RWidth)
    self.but_frame.pack(side=BOTTOM, anchor=W)
    self.exitbtn = Button(self.but_frame, text="Quit", font=("Helvetica", 14), command=self.__mainWindow.destroy)
    self.outdoorbtn = Button(self.but_frame, text="Outdoor", font=("Helvetica", 14), command=self.show_hide_int)
    self.indoorbtn = Button(self.but_frame, text="Indoor", font=("Helvetica", 14), command=self.show_hide_int)
    self.but_frame.pack_propagate(0)
    self.exitbtn.pack(side=LEFT)
    self.outdoorbtn.pack(side=RIGHT)
    self.indoorbtn.pack(padx=5, side=RIGHT)
    self.ext_frame = Frame(self.__mainWindow)
    self.ext_frame.pack(side=LEFT)
    self.ext_title_label = Label(self.ext_frame, text = 'Outdoor Conditions', font=("Helvetica", 18), pady = 5)
    self.ext_title_label.pack(pady=5, side=TOP)
    self.ext_cond_frame = Frame(self.ext_frame, height=self.RHeight, width=self.RWidth/4)
    self.ext_cond_frame.pack_propagate(0)
    self.ext_cond_frame.pack(side=LEFT)
    self.ext_initlabelText = 'Temperature: '
    self.ext_initLabel = Label(self.ext_cond_frame, text = self.ext_initlabelText, font=("Helvetica", 14))
    self.ext_initLabel.pack(padx=5, pady=5, anchor= W)
    self.ext_initlabelText = 'Feels like: '
    self.ext_initLabel = Label(self.ext_cond_frame, text = self.ext_initlabelText, font=("Helvetica", 14))
    self.ext_initLabel.pack(padx=5, pady=5, anchor= W)
    self.ext_initlabelText = 'Humidity: '
    self.ext_initLabel = Label(self.ext_cond_frame, text = self.ext_initlabelText, font=("Helvetica", 14))
    self.ext_initLabel.pack(padx=5, pady=5, anchor= W)
    self.ext_cond2_frame = Frame(self.ext_frame, height=self.RHeight, width=self.RWidth/4)
    self.ext_cond2_frame.pack_propagate(0)
    self.ext_cond2_frame.pack(side=LEFT)
  
    self.ext_temp_labelText = 'Loading...'
    self.ext_temp_Label = Label(self.ext_cond2_frame, text = self.ext_temp_labelText, font=("Helvetica", 14))
    self.ext_temp_Label.pack(padx=5, pady=5, anchor= W)
    self.ext_feels_labelText = 'Loading...'
    self.ext_feels_Label = Label(self.ext_cond2_frame, text = self.ext_feels_labelText, font=("Helvetica", 14))
    self.ext_feels_Label.pack(padx=5, pady=5, anchor= W)
    self.ext_rh_labelText = 'Loading...'
    self.ext_rh_Label = Label(self.ext_cond2_frame, text = self.ext_rh_labelText, font=("Helvetica", 14))
    self.ext_rh_Label.pack(padx=5, pady=5, anchor= W)
    
    print "Empiezo a  mirar el tiempo"
    self.__mainWindow.after(1000, self.task)
    print "termino de mirar el tiempo"
    mainloop()
    print "despues del loop"
    
  def show_hide_int(self):
    if self.indoor==False:
      self.indoor = True
      self.draw_int()
      print 'indoor true'
    else:
      self.indoor = False
      self.int_frame.pack_forget()
      print 'indoor false'

  def draw_int(self):
    self.int_frame = Frame(self.__mainWindow, pady = 5)
    self.int_frame.pack(side=RIGHT)
    self.int_title_label = Label(self.int_frame, text = 'Indoor Conditions', font=("Helvetica", 18))
    self.int_title_label.pack(pady=5, side=TOP)
    self.int_cond_frame = Frame(self.int_frame, height=self.RHeight, width=self.RWidth/4)
    self.int_cond_frame.pack_propagate(0)
    self.int_cond_frame.pack(side=LEFT)
    self.int_initlabelText = 'Temperature: '
    self.int_initLabel = Label(self.int_cond_frame, text = self.int_initlabelText, font=("Helvetica", 14))
    self.int_initLabel.pack(padx=5, pady=5, anchor= W)
    self.int_initlabelText = 'Humidity: '
    self.int_initLabel = Label(self.int_cond_frame, text = self.int_initlabelText, font=("Helvetica", 14))
    self.int_initLabel.pack(padx=5, pady=5, anchor= W)
    self.int_initlabelText = 'Pressure: '
    self.int_initLabel = Label(self.int_cond_frame, text = self.int_initlabelText, font=("Helvetica", 14))
    self.int_initLabel.pack(padx=5, pady=5, anchor= W)
    self.int_initlabelText = 'CO2: '
    self.int_initLabel = Label(self.int_cond_frame, text = self.int_initlabelText, font=("Helvetica", 14))
    self.int_initLabel.pack(padx=5, pady=5, anchor= W)
    self.int_cond2_frame = Frame(self.int_frame, height=self.RHeight, width=self.RWidth/4)
    self.int_cond2_frame.pack_propagate(0)
    self.int_cond2_frame.pack(side=LEFT)
    self.int_temp_labelText = str(self.conditions[4])+ u"\u00b0"+'C'
    self.int_temp_Label = Label(self.int_cond2_frame, text = self.int_temp_labelText, font=("Helvetica", 14))
    self.int_temp_Label.pack(padx=5, pady=5, anchor= W)
    self.int_rh_labelText = str(self.conditions[5])+' %'
    self.int_rh_Label = Label(self.int_cond2_frame, text = self.int_rh_labelText, font=("Helvetica", 14))
    self.int_rh_Label.pack(padx=5, pady=5, anchor= W)
    self.int_pressure_labelText = str(self.conditions[6])+ ' mbar'
    self.int_pressure_humidityLabel = Label(self.int_cond2_frame, text = self.int_pressure_labelText, font=("Helvetica", 14))
    self.int_pressure_humidityLabel.pack(padx=5, pady=5, anchor= W)
    self.int_co2_labelText = str(self.conditions[7])+' ppm'
    self.int_co2_Label = Label(self.int_cond2_frame, text = self.int_co2_labelText, font=("Helvetica", 14))
    self.int_co2_Label.pack(padx=5, pady=5, anchor= W)
#.........这里部分代码省略.........
开发者ID:santirguez,项目名称:raspberryprojects,代码行数:103,代码来源:tk-basic.py

示例11: PiPresents

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

#.........这里部分代码省略.........
            call(["xset","s", "off"])
            call(["xset","s", "-dpms"])

        self.root=Tk()   
       
        self.title='Pi Presents - '+ self.pp_profile
        self.icon_text= 'Pi Presents'
        self.root.title(self.title)
        self.root.iconname(self.icon_text)
        self.root.config(bg=self.pp_background)

        self.mon.log(self, 'native screen dimensions are ' + str(self.root.winfo_screenwidth()) + ' x ' + str(self.root.winfo_screenheight()) + ' pixcels')
        if self.options['screensize'] =='':        
            self.screen_width = self.root.winfo_screenwidth()
            self.screen_height = self.root.winfo_screenheight()
        else:
            reason,message,self.screen_width,self.screen_height=self.parse_screen(self.options['screensize'])
            if reason =='error':
                self.mon.err(self,message)
                self.end('error',message)

        self.mon.log(self, 'commanded screen dimensions are ' + str(self.screen_width) + ' x ' + str(self.screen_height) + ' pixcels')
       
        # set window dimensions and decorations
        if self.options['fullscreen'] is False:
            self.window_width=int(self.root.winfo_screenwidth()*self.nonfull_window_width)
            self.window_height=int(self.root.winfo_screenheight()*self.nonfull_window_height)
            self.window_x=self.nonfull_window_x
            self.window_y=self.nonfull_window_y
            self.root.geometry("%dx%d%+d%+d" % (self.window_width,self.window_height,self.window_x,self.window_y))
        else:
            self.window_width=self.screen_width
            self.window_height=self.screen_height
            self.root.attributes('-fullscreen', True)
            os.system('unclutter 1>&- 2>&- &') # Suppress 'someone created a subwindow' complaints from unclutter
            self.window_x=0
            self.window_y=0  
            self.root.geometry("%dx%d%+d%+d"  % (self.window_width,self.window_height,self.window_x,self.window_y))
            self.root.attributes('-zoomed','1')

        # canvs cover the whole screen whatever the size of the window. 
        self.canvas_height=self.screen_height
        self.canvas_width=self.screen_width
  
        # make sure focus is set.
        self.root.focus_set()

        # define response to main window closing.
        self.root.protocol ("WM_DELETE_WINDOW", self.handle_user_abort)

        # setup a canvas onto which will be drawn the images or text
        self.canvas = Canvas(self.root, bg=self.pp_background)


        if self.options['fullscreen'] is True:
            self.canvas.config(height=self.canvas_height,
                               width=self.canvas_width,
                               highlightthickness=0)
        else:
            self.canvas.config(height=self.canvas_height,
                    width=self.canvas_width,
                        highlightthickness=1,
                               highlightcolor='yellow')
            
        self.canvas.place(x=0,y=0)
        # self.canvas.config(bg='black')
开发者ID:drewkeller,项目名称:pipresents-gapless,代码行数:70,代码来源:pipresents.py

示例12: __init__

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

    def __init__(self, width, height, pixelSize, top=False):
        self._maxWindowWidth = 1024

        self._master = Tk()
        self._q = Queue.Queue()
        self._hasFrame = False

        self.x = width
        self.y = height
        self._count = self.x * self.y

        self._values = []
        self._leds = []

        self._pixelSize = pixelSize
        self._pixelPad = int(pixelSize / 2)
        self._pixelSpace = 0

        self.initUI()
        self.configure(self.x, self.y)

        self.checkQ()

        self._master.attributes("-topmost", top)

    def checkQ(self):
        if not self._q.empty():
            data = self._q.get_nowait()
            self.updateUI(data)

        wait = 0
        if "darwin" in platform.system().lower():
            wait = 1
        self._master.after(wait, self.checkQ)
        self._master.update_idletasks()

    def mainloop(self):
        self._master.mainloop()

    def updateUI(self, data):
        size = len(data) / 3
        if size != self._count:
            log.warning("Bytecount mismatch")
            return

        for i in range(size):
            r = data[i * 3 + 0]
            g = data[i * 3 + 1]
            b = data[i * 3 + 2]

            self._values[i] = self.toHexColor(r, g, b)

        try:
            for i in range(self._count):
                self._canvas.itemconfig(self._leds[i], fill=self._values[i])
        except TclError:
            # Looks like the UI closed!
            pass

    def toHexColor(self, r, g, b):
        return "#{0:02x}{1:02x}{2:02x}".format(r, g, b)

    def update(self, data):
        self._q.put(data)

    def hasFrame(self):
        return not self._q.empty()

    def configure(self, x, y):
        self._type = type
        self.x = x
        self.y = y
        self._count = x * y

        self._values = []
        # init colors to all black (off)
        for i in range(self._count):
            self._values.append("#101010")

        c = self._canvas

        c.delete(ALL)
        self._leds = []
        for i in range(self._count):
            index = c.create_rectangle(
                0, 0, self._pixelSize, self._pixelSize, fill=self._values[i])
            self._leds.append(index)

        self.layoutPixels()

    def layoutPixels(self):
        if len(self._leds) == 0:
            return

        x_off = 0
        row = 0
        count = 0
        w = 0
#.........这里部分代码省略.........
开发者ID:flecno,项目名称:BiblioPixel,代码行数:103,代码来源:visualizerUI.py

示例13: Tk

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import attributes [as 别名]
else:
    grey = "light slate grey"
    green = "green"
    yellow = "yellow"
    red     = "red"
    white   = "white"
    black   = "black"

c_height = 476 #the border lines are approx 2px
c_width = 316 #316

root = Tk()
root.config(width=(c_width - 45), height=c_height, bg=black)
if not testMode:
    root.config(cursor="none")
    root.attributes("-fullscreen", True)    #if not in test mode switch to fullscreen


textFont = tkFont.Font(family="Helvetica", size=36, weight="bold")

# Declare Variables
measuredItems = ["RPM", "Water TMP", "Oil Temp", "Oil Press", "EGT", "Fuel Flow", "Fuel(left)", "Voltage"]
errorBoxItems = ["TEMP", "PRESS", "FUEL", "POWER", "ERROR"]
errorBoxItemsColor = ["red", "green", "green", "yellow", "green"]
measuredItemsColor = [red, green, yellow, green, green, green, green]
measuredItemsValue = [1, 65, 89, 10, 768, 7.8, 65, 12.6]
buttonPressed = ([0, 0, 0, 0, 0, 0, 0, 0])

#Flight Data#
roll = 0;
pitch = 0;
开发者ID:tsaG1337,项目名称:mEICAS,代码行数:33,代码来源:Main.py

示例14: dict

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import attributes [as 别名]
context = usb1.USBContext()
for device in context.getDeviceList(skip_on_error=True):
    print 'ID %04x:%04x' % (device.getVendorID(), device.getProductID()), '->'.join(str(x) for x in ['Bus %03i' % (device.getBusNumber(), )] + device.getPortNumberList()), 'Device', device.getDeviceAddress()


OPTIONS = dict(defaultextension='.jpg', title="Escolha o arquivo que deseja converter",
                  filetypes=[('Imagens', ('*.jpg', '*.jpeg', '*.png', '*.bmp')), ('Todos Arquivos', '*.*')])


placeholder = None

c_path = path.dirname(path.realpath(__file__))+sep

root = Tk()
root.geometry("450x450+200+200")
root.attributes("-alpha", 0.9)

root.title("Gravar Graficos na impressora")
# the_file = None


def select_file():
    the_file = askopenfilename(**OPTIONS)
    if the_file:
        converted_name = "converted.bmp"
        file_entry.configure(text=the_file)
        c_img = Image.open(the_file, 'r')
        c_img = c_img.convert('1')
        c_img.thumbnail((110, 110))
        c_img.save(converted_name, format="BMP")
        p_img = ImageTk.PhotoImage(Image.open(c_path+converted_name))
开发者ID:ronaldomg,项目名称:PrinterPCX,代码行数:33,代码来源:Main.py

示例15: print

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import attributes [as 别名]
                        mc.setBlock(x0+x,y0+y,z0+z,b,d)

    print("done")
    # TODO: entities
    return corner1,corner2

if __name__=='__main__':
    if len(argv) >= 2:
        path = argv[1]
    else:
        if int(version[0]) < 3:
            from tkFileDialog import askopenfilename
            from Tkinter import Tk
        else:
            from tkinter.filedialog import askopenfilename
            from tkinter import Tk
        master = Tk()
        master.attributes("-topmost", True)
        path = askopenfilename(filetypes=['schematic {*.schematic}'],title="Open")
        master.destroy()
        if not path:
            exit()

    mc = Minecraft()
    pos = mc.player.getTilePos()
    (corner0,corner1)=importSchematic(mc,path,pos.x,pos.y,pos.z,centerX=True,centerZ=True)
    mc.postToChat("Done drawing, putting player on top")
    y = corner1[1]
    while y > -256 and mc.getBlock(pos.x,y-1,pos.z) == block.AIR.id:
        y -= 1
    mc.player.setTilePos(pos.x,y,pos.z)
开发者ID:arpruss,项目名称:raspberryjam-pe,代码行数:33,代码来源:import.py


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