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


Python Main.opj函数代码示例

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


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

示例1: __init__

    def __init__(self, parent):
        wx.Window.__init__(self, parent)
        self.image1= wx.Image(opj('bitmaps/image.bmp'), wx.BITMAP_TYPE_BMP)
        self.image2= wx.Image(opj('bitmaps/toucan.png'), wx.BITMAP_TYPE_PNG)

        # the factors -- 1.0 does not not modify the image
        self.factorred=   1.0
        self.factorgreen= 1.0
        self.factorblue=  1.0
        self.factoralpha= 1.0

        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
        self.Bind(wx.EVT_SIZE, self.OnSize)
开发者ID:GadgetSteve,项目名称:Phoenix,代码行数:14,代码来源:AdjustChannels.py

示例2: OnPaint

    def OnPaint(self, evt):
        dc = wx.PaintDC(self)
        dc.SetBackground(wx.Brush("WHITE"))
        dc.Clear()

        dc.SetFont(wx.Font(16, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, True))
        dc.DrawText("Bitmap alpha blending (on all ports but gtk+ 1.2)",
                    25,25)
        
        bmp = wx.Bitmap(opj('bitmaps/toucan.png'))
        if "gtk1" in wx.PlatformInfo:
            # Try to make up for lack of alpha support in wxGTK (gtk+
            # 1.2) by converting the alpha blending into a
            # transparency mask.

            # first convert to a wx.Image
            img = bmp.ConvertToImage()

            # Then convert the alpha channel to a mask, specifying the
            # threshold below which alpha will be made fully
            # transparent
            img.ConvertAlphaToMask(220)

            # convert back to a wx.Bitmap
            bmp = img.ConvertToBitmap()

            
        dc.DrawBitmap(bmp, 25,100, True)

        dc.SetFont(self.GetFont())
        y = 75
        for line in range(10):
            y += dc.GetCharHeight() + 5
            dc.DrawText(msg, 200, y)
        dc.DrawBitmap(bmp, 250,100, True)
开发者ID:DevPlayer-,项目名称:Phoenix,代码行数:35,代码来源:ImageAlpha.py

示例3: OnButton2

 def OnButton2(self, evt):
     try:
         if True:
             sound = wx.Sound(opj('data/plan.wav'))
         else:
             # sounds can also be loaded from a buffer object
             data = open(opj('data/plan.wav'), 'rb').read()
             sound = wx.SoundFromData(data)
             
         self.log.write("before Play...\n")
         sound.Play(wx.SOUND_ASYNC)
         self.sound = sound  # save a reference (This shoudln't be needed, but there seems to be a bug...)
         wx.YieldIfNeeded()
         self.log.write("...after Play\n")
     except NotImplementedError, v:
         wx.MessageBox(str(v), "Exception Message")
开发者ID:PREM1980,项目名称:ecomstore,代码行数:16,代码来源:Sound.py

示例4: OnButton1

 def OnButton1(self, evt):
     try:
         sound = wx.Sound(opj('data/anykey.wav'))
         self.log.write("before Play...\n")
         sound.Play(wx.SOUND_SYNC)
         self.log.write("...after Play\n")
     except NotImplementedError, v:
         wx.MessageBox(str(v), "Exception Message")
开发者ID:PREM1980,项目名称:ecomstore,代码行数:8,代码来源:Sound.py

示例5: runTest

def runTest(frame, nb, log):
    bmp = wx.Image(opj('bitmaps/image.bmp'), wx.BITMAP_TYPE_BMP).ConvertToBitmap()
    gif = wx.Image(opj('bitmaps/image.gif'), wx.BITMAP_TYPE_GIF).ConvertToBitmap()
    png = wx.Image(opj('bitmaps/image.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap()
    jpg = wx.Image(opj('bitmaps/image.jpg'), wx.BITMAP_TYPE_JPEG).ConvertToBitmap()

    panel = wx.Panel(nb, -1)

    pos = 10
    wx.StaticBitmap(panel, -1, bmp, (10, pos), (bmp.GetWidth(), bmp.GetHeight()))

    pos = pos + bmp.GetHeight() + 10
    wx.StaticBitmap(panel, -1, gif, (10, pos), (gif.GetWidth(), gif.GetHeight()))

    pos = pos + gif.GetHeight() + 10
    wx.StaticBitmap(panel, -1, png, (10, pos), (png.GetWidth(), png.GetHeight()))

    pos = pos + png.GetHeight() + 10
    wx.StaticBitmap(panel, -1, jpg, (10, pos), (jpg.GetWidth(), jpg.GetHeight()))

    return panel
开发者ID:Bluehorn,项目名称:wxPython,代码行数:21,代码来源:Image.py

示例6: __init__

    def __init__(self, parent, log):
        self.log = log
        wx.Panel.__init__(self, parent, -1,
                          style=wx.TAB_TRAVERSAL|wx.CLIP_CHILDREN)

        # Create some controls
        try:
            self.mc = wx.media.MediaCtrl(self, style=wx.SIMPLE_BORDER)
        except NotImplementedError:
            self.Destroy()
            raise

        btn1 = wx.Button(self, -1, "Load File")
        self.Bind(wx.EVT_BUTTON, self.OnLoadFile, btn1)
        
        btn2 = wx.Button(self, -1, "Play")
        self.Bind(wx.EVT_BUTTON, self.OnPlay, btn2)
        
        btn3 = wx.Button(self, -1, "Pause")
        self.Bind(wx.EVT_BUTTON, self.OnPause, btn3)
        
        btn4 = wx.Button(self, -1, "Stop")
        self.Bind(wx.EVT_BUTTON, self.OnStop, btn4)

        slider = wx.Slider(self, -1, 0, 0, 0)
        self.slider = slider
        self.Bind(wx.EVT_SLIDER, self.OnSeek, slider)

        self.st_size = wx.StaticText(self, -1, size=(100,-1))
        self.st_len  = wx.StaticText(self, -1, size=(100,-1))
        self.st_pos  = wx.StaticText(self, -1, size=(100,-1))
        
        
        # setup the layout
        sizer = wx.GridBagSizer(5,5)
        sizer.Add(self.mc, (1,1), span=(5,1))#, flag=wx.EXPAND)
        sizer.Add(btn1, (1,3))
        sizer.Add(btn2, (2,3))
        sizer.Add(btn3, (3,3))
        sizer.Add(btn4, (4,3))
        sizer.Add(slider, (6,1), flag=wx.EXPAND)
        sizer.Add(self.st_size, (1, 5))
        sizer.Add(self.st_len,  (2, 5))
        sizer.Add(self.st_pos,  (3, 5))
        self.SetSizer(sizer)

        self.DoLoadFile(opj("data/testmovie.mpg"))
        self.mc.Stop()

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.OnTimer)
        self.timer.Start(100)
开发者ID:project-renard-survey,项目名称:chandler,代码行数:52,代码来源:MediaCtrl.py

示例7: __init__

    def __init__(self, parent, log):
        self.log = log
        wx.Panel.__init__(self, parent, -1)

        sizer = wx.FlexGridSizer(2,3,5,5)
        for name in GIFNames:
            ani = GIFAnimationCtrl(self, -1, opj(name))
            ani.GetPlayer().UseBackgroundColour(True)
            ani.Play()
            sizer.Add(ani, 0, wx.ALL, 10)

        border = wx.BoxSizer()
        border.Add(sizer, 1, wx.EXPAND|wx.ALL, 20)
        self.SetSizer(border)
开发者ID:PREM1980,项目名称:ecomstore,代码行数:14,代码来源:GIFAnimationCtrl.py

示例8: __init__

    def __init__(self, parent, log):
        wx.Panel.__init__(self, parent, -1)

        data = open(opj('bitmaps/image.png'), "rb").read()
        stream = cStringIO.StringIO(data)

        bmp = wx.BitmapFromImage( wx.ImageFromStream( stream ))

        wx.StaticText(
            self, -1, "This image was loaded from a Python file-like object:", 
            (15, 15)
            )

        wx.StaticBitmap(self, -1, bmp, (15, 45))#, (bmp.GetWidth(), bmp.GetHeight()))
开发者ID:2015E8007361074,项目名称:load2python,代码行数:14,代码来源:ImageFromStream.py

示例9: __init__

    def __init__(self, parent, log):
        self.log = log
        wx.Panel.__init__(self, parent, -1)

        sizer = wx.FlexGridSizer(2, 3, 5, 5)
        for name in GIFNames:
            ani = wx.animate.Animation(opj(name))
            ctrl = wx.animate.AnimationCtrl(self, -1, ani)
            ctrl.SetUseWindowBackgroundColour()
            ctrl.Play()
            sizer.AddF(ctrl, wx.SizerFlags().Border(wx.ALL, 10))

        border = wx.BoxSizer()
        border.AddF(sizer, wx.SizerFlags(1).Expand().Border(wx.ALL, 20))
        self.SetSizer(border)
开发者ID:apetcho,项目名称:wxPython-In-Action,代码行数:15,代码来源:AnimateCtrl.py

示例10: __init__

    def __init__(self, parent, log):
        self.log = log
        wx.Panel.__init__(self, parent, -1)

        sizer = wx.FlexGridSizer(cols=3, hgap=5, vgap=5)
        for name in GIFNames:
            ani = Animation(opj(name))
            ctrl = AnimationCtrl(self, -1, ani)
            ctrl.SetBackgroundColour(self.GetBackgroundColour())
            ctrl.Play()
            sizer.Add(ctrl, 0, wx.ALL, 10)

        border = wx.BoxSizer()
        border.Add(sizer, 1, wx.EXPAND | wx.ALL, 20)
        self.SetSizer(border)
开发者ID:christianbrodbeck,项目名称:Phoenix,代码行数:15,代码来源:AnimateCtrl.py

示例11: __init__

    def __init__(self, parent, log):
        self.log = log
        wx.Panel.__init__(self, parent, -1)

        sizer = wx.FlexGridSizer(2,3,5,5)
        for name in GIFNames:
            ani = wx.animate.Animation(opj(name))
            ctrl = wx.animate.AnimationCtrl(self, -1, ani)
            ctrl.SetUseWindowBackgroundColour()
            ctrl.Play()
            sizer.Add(ctrl, 0, wx.ALL, 10)

        border = wx.BoxSizer()
        border.Add(sizer, 1, wx.EXPAND|wx.ALL, 20)
        self.SetSizer(border)
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:15,代码来源:AnimateCtrl.py

示例12: __init__

    def __init__(self, parent, log):
        self.choices = []
        self.choices = exampleStrings
        
        self._init_ctrls(parent)

        self.log = log

        lang = wx.LANGUAGE_DEFAULT
        filter = 'demo'
        langs = (wx.LANGUAGE_AFRIKAANS, wx.LANGUAGE_ENGLISH, wx.LANGUAGE_DEFAULT, 
                 wx.LANGUAGE_SPANISH, wx.LANGUAGE_GERMAN, wx.LANGUAGE_ITALIAN,
                 wx.LANGUAGE_FRENCH)


        # usually you would define wx.Locale in your wx.App.OnInit class.
        # for the demo we just define it in this module
        self.locale = None
        wx.Locale.AddCatalogLookupPathPrefix(opj('data/locale'))
        self.updateLanguage(wx.LANGUAGE_DEFAULT)

        
        self.filterMap = {'demo': langlistctrl.LC_ONLY, 
                          'available': langlistctrl.LC_AVAILABLE, 
                          'all': langlistctrl.LC_ALL}
                        
        self.filterIdxMap = {0: 'demo', 
                             1: 'available', 
                             2: 'all'}
        self.langs = langs
        self.langCtrl = langlistctrl.LanguageListCtrl(self.langCtrlContainer, -1, 
              filter=self.filterMap[filter], only=langs, select=lang)
        
        self.langCtrl.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnLangSelectAndTranslate)
        self.langCtrl.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnClearTranslatedText)
              
        self.OnLangCtrlContainerSize()
        
        self.englishBaseCh.Select(0)
        self.OnLangSelectAndTranslate()
开发者ID:2015E8007361074,项目名称:load2python,代码行数:40,代码来源:I18N.py

示例13: runTest

def runTest(frame, nb, log):
    bmp = wx.Image(opj('bitmaps/image.bmp'), wx.BITMAP_TYPE_BMP).ConvertToBitmap()
    gif = wx.Image(opj('bitmaps/image.gif'), wx.BITMAP_TYPE_GIF).ConvertToBitmap()
    png = wx.Image(opj('bitmaps/image.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap()
    jpg = wx.Image(opj('bitmaps/image.jpg'), wx.BITMAP_TYPE_JPEG).ConvertToBitmap()

    panel = wx.Panel(nb, -1)

    pos = 10
    wx.StaticBitmap(panel, -1, bmp, (10, pos))

    pos = pos + bmp.GetHeight() + 10
    wx.StaticBitmap(panel, -1, gif, (10, pos))

    pos = pos + gif.GetHeight() + 10
    wx.StaticBitmap(panel, -1, png, (10, pos))

    pos = pos + png.GetHeight() + 10
    wx.StaticBitmap(panel, -1, jpg, (10, pos))


    greyscale = wx.Image(opj('bitmaps/image.png'), wx.BITMAP_TYPE_PNG).ConvertToGreyscale().ConvertToBitmap()
    disabled = wx.Image(opj('bitmaps/image.png'), wx.BITMAP_TYPE_PNG).ConvertToDisabled().ConvertToBitmap()
    mono = wx.Image(opj('bitmaps/image.png'), wx.BITMAP_TYPE_PNG).ConvertToMono(0,255,255).ConvertToBitmap()
    
    pos = 10
    wx.StaticBitmap(panel, -1, greyscale, (320, pos))
    
    pos = pos + greyscale.GetHeight() + 10
    wx.StaticBitmap(panel, -1, disabled, (320, pos))

    pos = pos + disabled.GetHeight() + 10
    wx.StaticBitmap(panel, -1, mono, (320, pos))


    return panel
开发者ID:2015E8007361074,项目名称:load2python,代码行数:36,代码来源:Image.py

示例14: Render

    def Render(self, dc):
        # Draw some stuff on the plain dc
        sz = self.GetSize()
        dc.SetPen(wx.Pen("navy", 1))
        x = y = 0
        while x < sz.width * 2 or y < sz.height * 2:
            x += 20
            y += 20
            dc.DrawLine(x, 0, 0, y)

        # now draw something with cairo
        ctx = wx.lib.wxcairo.ContextFromDC(dc)
        ctx.set_line_width(15)
        ctx.move_to(125, 25)
        ctx.line_to(225, 225)
        ctx.rel_line_to(-200, 0)
        ctx.close_path()
        ctx.set_source_rgba(0, 0, 0.5, 1)
        ctx.stroke()

        # and something else...
        ctx.arc(200, 200, 80, 0, math.pi*2)
        ctx.set_source_rgba(0, 1, 1, 0.5)
        ctx.fill_preserve()
        ctx.set_source_rgb(1, 0.5, 0)
        ctx.stroke()

        # here's a gradient pattern
        ptn = cairo.RadialGradient(315, 70, 25,
                                   302, 70, 128)
        ptn.add_color_stop_rgba(0, 1,1,1,1)
        ptn.add_color_stop_rgba(1, 0,0,0,1)
        ctx.set_source(ptn)
        ctx.arc(328, 96, 75, 0, math.pi*2)
        ctx.fill()

        # Draw some text
        face = wx.lib.wxcairo.FontFaceFromFont(
            wx.FFont(10, wx.FONTFAMILY_SWISS, wx.FONTFLAG_BOLD))
        ctx.set_font_face(face)
        ctx.set_font_size(60)
        ctx.move_to(360, 180)
        ctx.set_source_rgb(0, 0, 0)
        ctx.show_text("Hello")

        # Text as a path, with fill and stroke
        ctx.move_to(400, 220)
        ctx.text_path("World")
        ctx.set_source_rgb(0.39, 0.07, 0.78)
        ctx.fill_preserve()
        ctx.set_source_rgb(0,0,0)
        ctx.set_line_width(2)
        ctx.stroke()

        # Show iterating and modifying a (text) path
        ctx.new_path()
        ctx.move_to(0, 0)
        ctx.set_source_rgb(0.3, 0.3, 0.3)
        ctx.set_font_size(30)
        text = "This path was warped..."
        ctx.text_path(text)
        tw, th = ctx.text_extents(text)[2:4]
        self.warpPath(ctx, tw, th, 360,300)
        ctx.fill()

        # Drawing a bitmap.  Note that we can easily load a PNG file
        # into a surface, but I wanted to show how to convert from a
        # wx.Bitmap here instead.  This is how to do it using just cairo:
        #img = cairo.ImageSurface.create_from_png(opj('bitmaps/toucan.png'))

        # And this is how to convert a wx.Btmap to a cairo image
        # surface.  NOTE: currently on Mac there appears to be a
        # problem using conversions of some types of images.  They
        # show up totally transparent when used. The conversion itself
        # appears to be working okay, because converting back to
        # wx.Bitmap or writing the image surface to a file produces
        # the expected result.  The other platforms are okay.
        bmp = wx.Bitmap(opj('bitmaps/toucan.png'))
        #bmp = wx.Bitmap(opj('bitmaps/splash.png'))
        img = wx.lib.wxcairo.ImageSurfaceFromBitmap(bmp)

        ctx.set_source_surface(img, 70, 230)
        ctx.paint()

        # this is how to convert an image surface to a wx.Bitmap
        bmp2 = wx.lib.wxcairo.BitmapFromImageSurface(img)
        dc.DrawBitmap(bmp2, 280, 300)
开发者ID:DevPlayer-,项目名称:Phoenix,代码行数:87,代码来源:Cairo.py

示例15: initialise

 def initialise(self):
     
     #title font
     self.font = wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.BOLD)
            
     #use of scroll bar window
     self.scroll = wx.ScrolledWindow(self, -1)
     self.scroll.SetScrollbars(1,1,1000,1000)
     
     #setting up the sizer for use with scroll bar window 
     self.sizer = wx.BoxSizer(wx.VERTICAL)
     self.scroll.SetSizer(self.sizer)
     
     #the karstolution schematic diagram in the top-left
     png = wx.Image(opj('structure.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap()
     wx.StaticBitmap(self.scroll, -1, png, (10, 10), (png.GetWidth(), png.GetHeight())) 
     #the run button on the top-left, binded to self.OnButtonClick function
     button=wx.Button(self.scroll,-1,"Run Karstolution",(800,60))
     self.Bind(wx.EVT_BUTTON,partial( self.OnButtonClick,data=self.data,output=self.output_file),button)
     # the rest of the GUI interface takes either from the basic or advanced view
     #which come from their independant modules
     self.basic_panel=Basic(self.scroll,self.data,self.name_config)
     self.advanced_panel=Advanced(self.scroll,self.data,self.name_config)
     #the basic view is hidden first but can be switched into
     self.basic_panel.Hide()
     #adding the two views into the sizer
     self.sizer.Add(self.basic_panel, 1, wx.EXPAND)
     self.sizer.Add(self.advanced_panel, 2, wx.EXPAND)
     
     #creating the status bar at the bottom
     self.CreateStatusBar()
     
     #creating menu at top
     filemenu=wx.Menu()
     menuBar=wx.MenuBar()
     #file is only option at this stage
     menuBar.Append(filemenu,"&File")
     self.SetMenuBar(menuBar)
     
     #switch between the Advanced and Basic view
     toggle=filemenu.Append(wx.ID_ANY,"Switch Basic/Advanced",
     """Switch between the default Basic view or the Advanced view 
     with all possible parameters""")
     #open box with information about Karstolution
     menuAbout=filemenu.Append(wx.ID_ABOUT, "&About",
     "Information about this program")
     #exit the program
     menuExit=filemenu.Append(wx.ID_EXIT,"&Exit","Terminate the program")
     
     #binding the events (functions) to the menu items
     self.Bind(wx.EVT_MENU,self.OnAbout,menuAbout)
     self.Bind(wx.EVT_MENU,self.OnCheck,toggle)
     self.Bind(wx.EVT_MENU,self.OnExit, menuExit)
     
     #hidden features, that you need to expand the window to access
     #the Calculate Drip option (default=yes), allows you to over-ride the
     #drip-rate calculation (based on user-inputted min drip interval & store size)
     #and instead run the model just using the user-inputted values as the
     #absolute drip-rate (used for all time-steps of the model)
     self.cb = wx.CheckBox(self, -1, 'Calculate Drips ?', (1050, 270))
     self.cb.SetValue(True)
     self.Bind(wx.EVT_CHECKBOX, self.GetId, self.cb)
     
     #Allows the model to be run multiple times, iterating over a range
     #of parameter values. 
     batch1=wx.Button(self,-1,"Run Batch Mode",(1050,225))
     self.Bind(wx.EVT_BUTTON,self.OnBatch,batch1)
     self.label=wx.StaticText(self,-1,'Batch Mode: ',(1050,10))
     self.label.SetFont(self.font)
     self.label=wx.StaticText(self,-1,'Choose parameter to iterate: ',(1050,40))
     lister=wx.ListBox(self,-1,(1050,60),(180,80),[thing[0] for thing in self.list_options],wx.LB_SINGLE)
     lister.SetSelection(0)
     self.Bind(wx.EVT_LISTBOX,self.OnChoose,lister)
     self.min_b=wx.StaticText(self,-1,'Min Value: ',(1050,150))
     self.min_batch=wx.TextCtrl(self,-1,str(self.batch_p[0]),(1130,150))
     self.Bind(wx.EVT_TEXT,partial( self.assign, name=self.min_batch,id1=0),self.min_batch)
     self.max_b=wx.StaticText(self,-1,'Max Value: ',(1050,175))
     self.max_batch=wx.TextCtrl(self,-1,str(self.batch_p[1]),(1130,175))
     self.Bind(wx.EVT_TEXT,partial( self.assign, name=self.max_batch,id1=1),self.max_batch)
     self.it_b=wx.StaticText(self,-1,'# Iterations: ',(1050,200))
     self.it_batch=wx.TextCtrl(self,-1,str(self.batch_p[2]),(1130,200))
     self.Bind(wx.EVT_TEXT,partial( self.assign, name=self.it_batch,id1=2),self.it_batch)
     
     #telling wxpython the layout is all G       
     self.sizer.Layout()
开发者ID:mukhlis-mah,项目名称:karstolution,代码行数:85,代码来源:gui.py


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