本文整理汇总了Python中Images类的典型用法代码示例。如果您正苦于以下问题:Python Images类的具体用法?Python Images怎么用?Python Images使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Images类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doRawImageFileWithCallbacks
def doRawImageFileWithCallbacks(context):
url = GetURL(kRawColorImage)
if url is not None:
Images.doImageWithCallbacksCreatedFromURL(context, url,
RAW_IMAGE_WIDTH, RAW_IMAGE_HEIGHT,
8, True); # 8 bits per component, isColor = True
示例2: Function
class Function(QtGui.QWidget,functions.Ui_functions):
def __init__(self, conn, stackedWidget, parent=None):
super(self.__class__, self).__init__()
self.setupUi(self)
self.listImage.clicked.connect(lambda: self.toListImages(conn,stackedWidget))
self.back1.clicked.connect(lambda : self.toCreds(stackedWidget))
self.window4 = None
self.window5 = None
self.window6 = None
self.window7 = None
self.window8 = None
self.window9 = None
self.window10 = None
self.window11 = None
self.window12 = None
def toListImages(self,conn,stackedWidget):
images = conn.list_images()
if self.window4 == None:
self.window4 = Images(images)
self.window4.show()
def toCreds(self,stackedWidget):
creds=Creds(stackedWidget)
stackedWidget.addWidget(creds)
stackedWidget.setCurrentWidget(creds)
示例3: __init__
def __init__(self, pos, text, effect, small = False):
self.pos = pos
self.text = text
self.effect = effect
self.pressed = False
self.font = Game.get_font()
if small:
url_base = "img/gui/button_small"
else:
url_base = "img/gui/button"
self.unpressed_image = Images.load_imageurl(url_base + "_up.png")
self.hovered_image = Images.load_imageurl(url_base + "_hover.png")
self.pressed_image = Images.load_imageurl(url_base + "_down.png")
示例4: load_images_for
def load_images_for(self, directory):
img_idle_l = Images.load_imageurl("img/player/" + directory + "/idle.png")
img_idle_r = Images.flip_horizontal(img_idle_l)
imgs_idle = (img_idle_l, img_idle_r)
img_swim_1_l = Images.load_imageurl("img/player/" + directory + "/swim1.png")
img_swim_1_u = Images.rotate(img_swim_1_l, -90)
img_swim_1_r = Images.flip_horizontal(img_swim_1_l)
img_swim_1_d = Images.rotate(img_swim_1_l, 90)
imgs_swim_1 = (img_swim_1_l, img_swim_1_u, img_swim_1_r, img_swim_1_d)
img_swim_2_l = Images.load_imageurl("img/player/" + directory + "/swim2.png")
img_swim_2_u = Images.rotate(img_swim_2_l, -90)
img_swim_2_r = Images.flip_horizontal(img_swim_2_l)
img_swim_2_d = Images.rotate(img_swim_2_l, 90)
imgs_swim_2 = (img_swim_2_l, img_swim_2_u, img_swim_2_r, img_swim_2_d)
return (imgs_idle, imgs_swim_1, imgs_swim_2)
示例5: __init__
def __init__(self, *args, **kwds):
# begin wxGlade: PreferencesDlg.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE
wx.Dialog.__init__(self, *args, **kwds)
self.panel_3 = wx.Panel(self, -1)
self.l_dbfile = wx.StaticText(self.panel_3, -1, _("Database file"))
self.dbfile = wx.TextCtrl(self.panel_3, ID_DB, "", style=wx.TE_READONLY)
self.b_ok = wx.Button(self.panel_3, wx.ID_OK, "")
self.b_apply = wx.Button(self.panel_3, wx.ID_APPLY, "")
self.b_cancel = wx.Button(self.panel_3, wx.ID_CANCEL, "")
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_TEXT, self.OnChanged, id=ID_DB)
self.Bind(wx.EVT_BUTTON, self.OnOK, self.b_ok)
self.Bind(wx.EVT_BUTTON, self.OnApply, self.b_apply)
# end wxGlade
self.b_dbfile = wx.BitmapButton(self.panel_3, -1, bitmap=Images.getNetwork_server_databaseBitmap())
self.Bind(wx.EVT_BUTTON, self.OnDBfile, self.b_dbfile)
self.__do_layout_nowxglade()
self.obj = defaultdict()
# Register PubSub Listener
pub.subscribe(self.Populate, 'dialog.preferences.populate') #@UndefinedVariable
示例6: run
def run(self):
""" Perform Threaded Action """
# get variables here
path = self.path
validExt = ["jpg","jpeg"]
count = 0
for root, dirs, files in os.walk(path):
for f in files:
if(f.lower()[f.rfind(".")+1:] in validExt):
self.im.append(Images.loader(root,f))
tmpim = Image.open(os.path.join(root,f))
tmpim.thumbnail((125,125))
tmpim = Conversions.padpiltoimage(tmpim,125,125).ConvertToBitmap()
self.il.Add(tmpim)
count += 1
wx.PostEvent(self.frame,ReturnFunction(count,self.id,0))
self.imList.SetImageList(self.il, wx.IMAGE_LIST_SMALL)
#self.imList.SetImageList(self.il, wx.IMAGE_LIST_NORMAL)
self.imList.InsertColumn(0,'',width=130)
for i in range(count):
self.imList.InsertStringItem(i,'')
self.imList.SetItemImage(i,i)
wx.PostEvent(self.frame, ReturnFunction("Ready...",self.id,1))
示例7: addWindowToolBar
def addWindowToolBar(self, parent):
"""Toolbar for changing frame views"""
toolbar = ToolBar(parent, self)
img = Images.closeframe()
hlptxt="Close current sideframe"
toolbar.addButton('tile vertical', self.closeChildFrame, img, hlptxt)
img = Images.detachframe()
hlptxt="Detach current sideframe as seperate window"
toolbar.addButton('tile vertical', self.detachChildFrame, img, hlptxt)
img = Images.tilevertical()
hlptxt="Tile frames vertically"
toolbar.addButton('x', self.tileVertical, img, hlptxt)
img = Images.tilehorizontal()
hlptxt="Tile frames horizontally"
toolbar.addButton('tile horizontal', self.tileHorizontal, img, hlptxt)
return toolbar
示例8: __init__
def __init__(self, buttons, labels = [], background = False):
self.mouse_pressed = False
self.buttons = buttons
self.labels = labels
self.background = background
if background:
self.background_img = Images.load_imageurl("img/gui/menu_background.png")
示例9: createToolBar
def createToolBar(self):
"""Toolbar"""
self.toolbar = ToolBar(self.main, self)
self.toolbar.pack(side=TOP,fill=X,pady=1,before=self.m)
img = Images.openproject()
hlptxt="Open Project from file"
self.toolbar.addButton('Open Project', self.openProject, img, hlptxt)
img = Images.saveproject()
hlptxt="Save Project"
self.toolbar.addButton('Save Project', self.openProject, img, hlptxt)
img = Images.undo()
hlptxt="Undo"
self.toolbar.addButton('Save Project', self.openProject, img, hlptxt)
img = Images.zoomout()
hlptxt="Zoom Out"
self.toolbar.addButton('Save Project', self.sc.zoomOut, img, hlptxt)
img = Images.zoomin()
hlptxt="Zoom In"
self.toolbar.addButton('Save Project', self.sc.zoomIn, img, hlptxt)
img = Images.windowprefs()
hlptxt="Seqeuence display preferences"
self.toolbar.addButton('Seqeuence display preferences', self.sc.showPrefs,
img, hlptxt)
img = Images.prefs()
hlptxt="Preferences"
self.toolbar.addButton('Preferences', self.globalPrefsDialog, img, hlptxt)
return
示例10: __init__
def __init__(self, master, app=None):
Frame.__init__(self, master)
self.app = app
self.E = None
if hasattr(self.app,'p'):
self.p = self.app.p #reference to pipeline object
fr = Frame(self)
self.totalvar = IntVar()
lfr=Frame(fr)
lfr.pack()
Label(lfr,text='Datasets:').pack(side=LEFT,fill=BOTH)
l=Label(lfr,text='',textvariable=self.totalvar)
l.pack(side=LEFT,fill=BOTH)
b=Button(fr,text='update',command=self.update)
b.pack(side=TOP,fill=BOTH)
self.previmg = Images.prev()
b=Button(fr,text='prev',image=self.previmg,compound='left',command=self.prev)
b.pack(side=TOP,fill=BOTH)
self.nextimg = Images.next()
b=Button(fr,text='next',image=self.nextimg,compound='left',command=self.next)
b.pack(side=TOP,fill=BOTH)
self.numplotscounter = Pmw.Counter(fr,
labelpos='w',
label_text='plots:',
entryfield_value=1,
entry_width=3,
datatype = 'integer',
entryfield_command=self.replot,
entryfield_validate={'validator':'numeric', 'min':1,'max':12})
self.numplotscounter.pack()
self.overlayvar = BooleanVar(); self.overlayvar.set(False)
Checkbutton(fr, text='overlay plots', variable=self.overlayvar, command=self.replot).pack(side=TOP,fill=BOTH)
self.normalizevar = BooleanVar(); self.normalizevar.set(False)
Checkbutton(fr, text='normalize', variable=self.normalizevar, command=self.replot).pack(side=TOP,fill=BOTH)
fr.pack(side=LEFT)
self.plotframe = PlotPanel(parent=self, side=BOTTOM, height=200, tools=True)
self.dsindex = 0
self.plotframe.Opts.opts['fontsize']=10
b=Button(fr,text='open in Ekin',command=self.loadEkin)
b.pack(side=TOP,fill=BOTH)
return
示例11: load_items
def load_items():
items_file = open("items.json", "r")
global items
items = json.load(items_file)
items_file.close()
for itemname in items.keys():
item = items[itemname]
item["can_place"] = False
if "class" not in item.keys():
item["class"] = "ItemStack"
if isinstance(item["description"], str):
item["description"] = [item["description"]]
img = Images.load_imageurl(item["image"])
img_rotated = Images.rotate(img, 90)
item_images[itemname] = [img,
Images.flip_horizontal(img),
img_rotated,
Images.flip_horizontal(img_rotated),
Images.flip_completely(img)]
示例12: load_image
def load_image(self):
self.img = None
self.imgs = []
img = pygame.Surface((Game.BLOCK_SIZE * 3, Game.BLOCK_SIZE * 3), pygame.SRCALPHA, 32).convert_alpha() #not game scale
center = img.get_rect().center
#TODO: blit small diagonal arm image on img (after blitting item? but before rotation)
if self.item is not None:
#TODO: self.item may be a dummy pickled object that hasn't been loaded- what should we do?
#does the parent reference also get lost? that would be bad
#self.item.load_image()
item_img = self.item.imgs[0]
item_img = Images.scale(item_img, 1 / Game.SCALE)
img.blit(item_img, (0, 0))
start_deg = math.degrees(self.angle_start - 2 * self.angle_mid)
end_deg = math.degrees(self.angle_end - 2 * self.angle_mid)
for i in range(0, self.max_decay + 1, FRAME_LENGTH):
t = (self.max_decay - i) / self.max_decay
angle = (1 - t) * start_deg + t * end_deg + 225
rotated_img = Images.rotate(img, angle)
rotated_img.get_rect().center = center
self.imgs.append(Images.scale(rotated_img, Game.SCALE))
示例13: loadSinks
def loadSinks(self):
self.sink_list.addSink(Info.init())
self.sink_list.addSink(Buttons.init())
self.sink_list.addSink(Menus.init())
self.sink_list.addSink(Images.init())
self.sink_list.addSink(Layouts.init())
self.sink_list.addSink(Lists.init())
self.sink_list.addSink(Popups.init())
self.sink_list.addSink(Tables.init())
self.sink_list.addSink(Text.init())
self.sink_list.addSink(Trees.init())
self.sink_list.addSink(Frames.init())
self.sink_list.addSink(Tabs.init())
示例14: formatPanel
def formatPanel(self):
"""Showing format options"""
self.img1 = Images.formatsDiagram()
label1 = Label(self.main,image=self.img1)
label1.pack(fill=BOTH,padx=4,pady=4,ipadx=2,ipady=2)
text = """The layout/format of your data is specified in the configuration
file under the 'format' keyword. 8 typical formats
are built into DataPipeline, covering most simple cases."""
text=text.replace('\t','')
Label(self.main,text=text,wraplength=600).pack(fill=Y,side=TOP,pady=4)
panel2 = Frame(self.main)
panel2.pack(fill=Y,side=BOTTOM)
self.doButtons(panel2)
return
示例15: __init__
def __init__(self):
self.logo_image = Images.load_imageurl("img/title/logo.png")
self.logo_x = Game.SCREEN_WIDTH / 2 - self.logo_image.get_width() / 2
self.logo_y = Game.SCREEN_HEIGHT * 1 // 5
self.back_image = Images.load_imageurl("img/title/back.png")
self.back_width = self.back_image.get_width()
self.bg_y = Game.SCREEN_HEIGHT - self.back_image.get_height()
self.mid_image = Images.load_imageurl("img/title/mid.png")
self.mid_width = self.mid_image.get_width()
self.front_image = Images.load_imageurl("img/title/front.png")
self.front_width = self.front_image.get_width()
self.back_xs = [-self.back_width, 0, self.back_width]
self.mid_xs = [-self.mid_width, 0, self.mid_width]
self.front_xs = [-self.front_width, 0, self.front_width]
play_button = Button.Button((Game.SCREEN_WIDTH / 2 - Button.WIDTH / 2, Game.SCREEN_HEIGHT * 8 // 15), "Start Game", "menu")
if len(Game.get_worlds()) == 0:
play_button.next_menu = WorldNameMenu(self)
else:
play_button.next_menu = WorldSelectMenu(self)
options_button = Button.Button((Game.SCREEN_WIDTH / 2 - Button.WIDTH / 2, Game.SCREEN_HEIGHT * 10 // 15), "Options", "options")
quit_button = Button.Button((Game.SCREEN_WIDTH / 2 - Button.WIDTH / 2, Game.SCREEN_HEIGHT * 12 // 15), "Quit", "quit")
super().__init__([play_button, options_button, quit_button])