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


Python window.Window类代码示例

本文整理汇总了Python中window.Window的典型用法代码示例。如果您正苦于以下问题:Python Window类的具体用法?Python Window怎么用?Python Window使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __init__

 def __init__(self, x, y, width, height ):
     Window.__init__(self, x, y, width, height )
     
     Visettings.BoardX = (width-2)/2
     Visettings.BoardY = (height-2)/2
     
     self.setupPieces()
开发者ID:jacobgardner,项目名称:BloomVisualizer,代码行数:7,代码来源:gameboard.py

示例2: __init__

 def __init__(self, 
              slider_files, 
              pointer_files, 
              button_files,
              show_button=True,
              finish_callback=None, 
              slide_delay=8000,
              ):
     '''
     Initialize Wizard class.
     
     @param slider_files: The slider image files.
     @param pointer_files: The pointer image files.
     @param button_files: The button image files.
     @param show_button: if True will at last page show start button.
     @param finish_callback: The callback call when slider finish, this callback don't need input argument, default is None.
     @param slide_delay: The delay between slider images, default is 8000ms.
     '''
     Window.__init__(self)
     self.finish_callback = finish_callback
     
     self.set_position(gtk.WIN_POS_CENTER)
     self.set_resizable(False)
     self.wizard_box = WizardBox(slider_files, pointer_files, button_files, show_button, slide_delay)
     self.wizard_box.connect("close", lambda widget: self.destroy())
     self.connect("destroy", self.destroy_wizard)
     self.window_frame.add(self.wizard_box)
     self.add_move_event(self.wizard_box)
开发者ID:Jiarui315,项目名称:deepin-ui,代码行数:28,代码来源:slider.py

示例3: __init__

 def __init__(self):
     Window.__init__(self, 'main.glade')
     self._create_canvas()
     self._create_status_bar()
     self._create_history()
     self.view.main.set_size_request(450, 300)
     self.view.main.show()
开发者ID:hugoruscitti,项目名称:pybox,代码行数:7,代码来源:main.py

示例4: update_NET_DESKTOP_GEOMETRY

def update_NET_DESKTOP_GEOMETRY(force=False):
    global properties, xinerama

    old_geom = properties["_NET_DESKTOP_GEOMETRY"]
    old_xinerama = xinerama

    time.sleep(1)

    properties["_NET_DESKTOP_GEOMETRY"] = ptxcb.XROOT.get_desktop_geometry()
    xinerama = ptxcb.connection.xinerama_get_screens()

    if old_xinerama != xinerama or force:
        if not force and len(old_xinerama) == len(xinerama):
            for mon in Workspace.iter_all_monitors():
                mid = mon.id
                mon.refresh_bounds(
                    xinerama[mid]["x"], xinerama[mid]["y"], xinerama[mid]["width"], xinerama[mid]["height"]
                )
                mon.calculate_workarea()
        else:
            for mon in Workspace.iter_all_monitors():
                for tiler in mon.tilers:
                    tiler.destroy()

            for wid in Window.WINDOWS.keys():
                Window.remove(wid)

            for wsid in Workspace.WORKSPACES.keys():
                Monitor.remove(wsid)
                Workspace.remove(wsid)

            reset_properties()
            load_properties()
开发者ID:Excedrin,项目名称:pytyle2,代码行数:33,代码来源:state.py

示例5: setup_and_run

def setup_and_run():
    import gtk
    from window import Window

    window = Window()
    window._do_gui()
    gtk.main()
开发者ID:aulavirtual,项目名称:servidor,代码行数:7,代码来源:__init__.py

示例6: cross_validation

def cross_validation(X, y, metric, k, kernel='optimal', cv_fold=5.):
    scores = []
    # performing random permutation on data
    perm = np.random.permutation(X.shape[0])
    X = X[perm]
    y = y[perm]
    # dividing into chunks
    chunks = []
    y_chunks = []
    start = 0
    chunk_size = X.shape[0]/cv_fold
    end = chunk_size
    while end < X.shape[0]:
        chunks.append(X[start:end])
        y_chunks.append(y[start:end])
        start = end
        end += chunk_size
    if (start < X.shape[0]):
        chunks.append(X[start:])
        y_chunks.append(y[start:])
    # calculating accuracy for each chunk
    for i in range(len(chunks)):
        # for knn cross-validation
        # knn = MatrixBasedKNN(num_loops=0)
        # knn = knn.fit(np.concatenate(chunks[:i]+chunks[i+1:],axis=0),
        #        np.concatenate(y_chunks[:i]+y_chunks[i+1:],axis=0), metric)
        # y_pred = knn.predict(chunks[i],k)

        # for window cross-validation
        window = Window()
        window = window.fit(chunks[i], np.concatenate(chunks[:i]+chunks[i+1:], axis=0),
                            np.concatenate(y_chunks[:i]+y_chunks[i+1:], axis=0), k, metric, kernel)
        y_pred = window.predict()
        scores.append(accuracy(y_chunks[i], y_pred))
    return np.mean(scores)
开发者ID:penguin138,项目名称:mipt_ml,代码行数:35,代码来源:cross_validation.py

示例7: execute_cb

 def execute_cb(self, widget, event, data=None):
     window = Window(self)
     self.windows.append(window)
     
     localcaps = list(self.caps)
     for i in range(len(localcaps)):
         window.acceptCap(heapq.heappop(localcaps))
开发者ID:abidinz,项目名称:Stormee,代码行数:7,代码来源:tray.py

示例8: __init__

 def __init__(self):
     global MAPGENERATOR_ACTIVE
     if MAPGENERATOR_ACTIVE:
         raise Exception("Can't run more than one MapGenerator instance at a time")
     else: #this is the only instance
         MAPGENERATOR_ACTIVE = True
         try:
             Window.__init__(self)
             #create Tkinter Variables
             self.name        = StringVar(self, value=IMAGEMAP_NAME)
             self.size        = (DoubleVar(self, value=IMAGEMAP_SIZE[0]),
                                 DoubleVar(self, value=IMAGEMAP_SIZE[1]))
             self.destination = StringVar(self, value=IMAGEMAP_DESTINATION)
             self.codeType    = StringVar(self, value=IMAGEMAP_CODETYPE)
             #create controls
             imageControls = self.ImageControls(self, self.name, self.size)
             codeControls = self.CodeControls(self, self.destination, self.codeType)
             buttons = self.MapButtons(self)
             buttons.closeButton.config(command=self.destroy)
             buttons.generateButton.config(command=self.generate)
             imageControls.pack(pady=2, side=TOP)
             codeControls.pack(pady=2, side=TOP)
             buttons.pack(side=BOTTOM, padx=2, pady=2)
             #tweak window
             self.title("Create Map")
             self.geometry(MAPGENERATOR_GEOMETRY)
             self.resizable(False, False)
             # display everything
             self.update_idletasks()
             self.focus_force()
             self.mainloop()
         except:
             raise
         finally:
             MAPGENERATOR_ACTIVE = False
开发者ID:jefdaj,项目名称:wikidust,代码行数:35,代码来源:mapgenerate.py

示例9: __init__

    def __init__(self,  maxy, maxx, install_config):
        self.install_config = install_config
        self.menu_items = []

        self.maxx = maxx
        self.maxy = maxy
        self.win_width = 70
        self.win_height = 16

        self.win_starty = (self.maxy - self.win_height) / 2
        self.win_startx = (self.maxx - self.win_width) / 2

        self.menu_starty = self.win_starty + 6
        self.menu_height = 5
        self.progress_padding = 5
        self.progress_width = self.win_width - self.progress_padding
        self.progress_bar = ProgressBar(self.win_starty + 6, self.win_startx + self.progress_padding / 2, self.progress_width, new_win=True)

        self.disk_buttom_items = []
        self.disk_buttom_items.append(('<Custom>', self.custom_function, False))
        self.disk_buttom_items.append(('<Auto>', self.auto_function, False))

        self.window = Window(self.win_height, self.win_width, self.maxy, self.maxx, 'Select a disk', True, items = self.disk_buttom_items, menu_helper = self.save_index, position = 2, tab_enabled=False)
        self.partition_window = Window(self.win_height, self.win_width, self.maxy, self.maxx, 'Partition', True)
        self.devices = Device.refresh_devices()
开发者ID:megacoder,项目名称:photon,代码行数:25,代码来源:selectdisk.py

示例10: DiskPartitioner

class DiskPartitioner(object):
    def __init__(self,  maxy, maxx):
        self.menu_items = []

        self.maxx = maxx
        self.maxy = maxy
        self.win_width = 70
        self.win_height = 17

        self.win_starty = (self.maxy - self.win_height) / 2
        self.win_startx = (self.maxx - self.win_width) / 2

        self.menu_starty = self.win_starty + 10

        # initialize the devices
        self.devices = Device.refresh_devices()

        self.items =   [
                            ('Auto-partitioning - use entire disk',  self.guided_partitions, None),
                            ('Manual - not implemented!',  self.manual_partitions, None),
                        ]
        self.menu = Menu(self.menu_starty,  self.maxx, self.items)

        self.window = Window(self.win_height, self.win_width, self.maxy, self.maxx, 'Welcome to the Photon installer', True, self.menu)
        self.window.addstr(0, 0, 'First, we will setup your disks. \n\nYou can: \n\na) use auto-partitioning or\nb) you can do it manually.')

    def guided_partitions(self, params):
        return ActionResult(True, {'guided': True, 'devices': self.devices})

    def manual_partitions(self, params):
        raise NameError('Manual partitioning not implemented')

    def display(self, params):
        return self.window.do_action()
开发者ID:Andrew219,项目名称:photon,代码行数:34,代码来源:diskpartitioner.py

示例11: on_window_create

def on_window_create(event, window: Window):
    if window.name in ["dzen title", "XOSD", "panel"]:
        window.sticky = True
        window.can_focus = False
        window.above_all = True
        # log.critical("PANEL!")
    if window.type in ["dropdown", "menu", "notification", "tooltip"]:
        window.can_focus = False
开发者ID:kopchik,项目名称:swm,代码行数:8,代码来源:myconfig.py

示例12: calculate_windows

    def calculate_windows(self, save):
        window = Window(self.stock)
        windows = window.get_opportune_moments()
        train_data, test_data = self._split_shuffle_data(windows)

        train_file = self.make_trainer_file(train_data, DATA_TRAIN_FILE, save)
        test_file = self.make_trainer_file(test_data, DATA_TEST_FILE, save)
        return train_file, test_file
开发者ID:aviyashchin,项目名称:hacks,代码行数:8,代码来源:trainer.py

示例13: MyGame

class MyGame(Game):
    """Implements a Game that interfaces with the user."""

    def __init__(self):
        """Initialize the game."""
        Game.__init__(self)
        self.window = Window(800, 600)
        self.window.set_title("Olá, sou o PyGame.")
开发者ID:rafasgj,项目名称:algoritmos2,代码行数:8,代码来源:mygame.py

示例14: __init__

 def __init__(self, parent, title, top_left, w, h):
     #assert(parent is not None)
     #assert(isinstance(parent, (AppWindow)))
     #assert(isinstance(top_left, Point))
     if parent is None or not isinstance(parent, Container):
     	raise BadArgumentError("Expecting a valid parent window")
     
     Window.__init__(self, parent, title, top_left, w, h)
开发者ID:vikramahuja1001,项目名称:IT2-assignments,代码行数:8,代码来源:button.py

示例15: __init__

    def __init__(self, main, x, y, width, height=0):
        Window.__init__(self, main, x, y, width, height)
        self.grid_size = 10
        self.grid_visible = True
        self.selected_point = None
        self.snap_to_grid = False

        self.shape = Shape()
开发者ID:Bredgren,项目名称:Fractals,代码行数:8,代码来源:shape_window.py


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