本文整理汇总了Python中window.Window类的典型用法代码示例。如果您正苦于以下问题:Python Window类的具体用法?Python Window怎么用?Python Window使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Window类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: main
def main():
w = Window()
start = time.time()
while True:
print "search game area"
w.getScreenShot()
w.current_screen.save("test.png")
gameWin = findGameArea(w)
if gameWin is not None:
print "found area"
break
gameWin.getScreenShot()
gameWin.current_screen.save("whack1.png", "png")
whack = Whack(gameWin)
area = whack.getArea()
area.getScreenShot()
area.current_screen.save("whack2.png", "png")
i=0
while True:
if whack.hasArea():
break
time.sleep(0.3)
ignoreUntilNextClick = (9999,9999)
resetIgnore = 0
while True:
if resetIgnore < time.time():
print "reset",resetIgnore, time.time()
resetIgnore = time.time() + 100
ignoreUntilNextClick = (9999,9999)
i+=1
print i
print "search button"
coords = whack.findClicks(i)
if len(coords) < 1:
continue
if len(coords) > 7:
return
c=0
last = (9999, 9999)
for coord in coords:
c+=1
y,x = coord
print "coord",coord
if y > ignoreUntilNextClick[0] - 90 and y < ignoreUntilNextClick[0] + 90 and x == ignoreUntilNextClick[1]:
print "ignore", ignoreUntilNextClick
continue
#tmp = SubWindow(area, x-10, y-10, 30, 30)
#tmp.getScreenShot()
#tmp.current_screen.save("click"+str(i)+str(c)+".png")
area.mouseMove(x, y)
area.mouseClick()
gameWin.mouseMove(10, 10)
last = coord
if last[0] != 9999:
print "last",last
ignoreUntilNextClick = last
resetIgnore = time.time() + 0.6
print time.time()-start
开发者ID:balrok,项目名称:pythonstuff,代码行数:58,代码来源:whack.py
示例17: runApp
def runApp():
if config.DEBUG:
sys.argv.append("--remote-debugging-port=" + str(config.DEBUG_PORT))
app = QApplication(sys.argv)
app.setApplicationName(config.APP_NAME)
QApplication.setQuitOnLastWindowClosed(False)
window = Window()
window.showMaximized()
app.exec_()
开发者ID:zhsj,项目名称:qwechat,代码行数:9,代码来源:app.py
示例18: __init__
def __init__(self, title, default_width=None, default_height=None, mask_type=None,
close_callback=None,
modal=True,
window_hint=gtk.gdk.WINDOW_TYPE_HINT_DIALOG,
window_pos=None,
skip_taskbar_hint=True,
resizable=False):
'''Dialog box.'''
Window.__init__(self, resizable)
self.default_width = default_width
self.default_height = default_height
self.mask_type = mask_type
if window_pos:
self.set_position(window_pos)
self.set_modal(modal) # grab focus to avoid build too many skin window
if window_hint:
self.set_type_hint(window_hint)
self.set_skip_taskbar_hint(skip_taskbar_hint) # skip taskbar
if self.default_width != None and self.default_height != None:
self.set_default_size(self.default_width, self.default_height)
if not resizable:
self.set_geometry_hints(None, self.default_width, self.default_height, -1, -1, -1, -1, -1, -1, -1, -1)
self.padding_left = 2
self.padding_right = 2
self.titlebar = Titlebar(
["close"],
None,
title)
self.add_move_event(self.titlebar)
self.body_box = gtk.VBox()
self.body_align = gtk.Alignment()
self.body_align.set(0.5, 0.5, 1, 1)
self.body_align.set_padding(0, 0, self.padding_left, self.padding_right)
self.body_align.add(self.body_box)
self.button_box = gtk.HBox()
self.left_button_box = DialogLeftButtonBox()
self.right_button_box = DialogRightButtonBox()
self.button_box.pack_start(self.left_button_box, True, True)
self.button_box.pack_start(self.right_button_box, True, True)
self.window_frame.pack_start(self.titlebar, False, False)
self.window_frame.pack_start(self.body_align, True, True)
self.window_frame.pack_start(self.button_box, False, False)
if close_callback:
self.titlebar.close_button.connect("clicked", lambda w: close_callback())
self.connect("destroy", lambda w: close_callback())
else:
self.titlebar.close_button.connect("clicked", lambda w: self.destroy())
self.connect("destroy", lambda w: self.destroy())
self.draw_mask = self.get_mask_func(self, 1, 1, 0, 1)
开发者ID:netphi,项目名称:deepin-ui,代码行数:57,代码来源:dialog.py
示例19: __init__
def __init__(self, classes, selected_classes):
"""
Params:
`classes`: list of strings with all class names.
`selected_classes`: list of strings with selected classes.
"""
Window.__init__(self, 'classlist.glade')
self._create_list()
self._populate_model(classes, selected_classes)
self.view.classlist.set_default_size(300, 300)
开发者ID:hugoruscitti,项目名称:pybox,代码行数:10,代码来源:classlist.py
示例20: __init__
def __init__(self, parent, maze, moves, width):
Window.__init__(self, parent)
Frame.__init__(self, parent, background = "white")
self.maze = maze
self.canvas = Canvas(self)
self.queue = moves
self.delay = DELAY
self.size = get_size(self.maze, width)
#self.photo = PhotoImage(file = "mouse.gif")
self.init_ui()
开发者ID:acevedog,项目名称:Tkinter-Maze,代码行数:10,代码来源:window_canvas.py
注:本文中的window.Window类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论