User Profile

Collapse

Profile Sidebar

Collapse
nobugus
nobugus
Banned
Last Activity: Dec 8 '07, 11:11 PM
Joined: May 24 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • nobugus
    started a topic Replacing HEX with HEX in PHP - preg_replace()
    in PHP

    Replacing HEX with HEX in PHP - preg_replace()

    Hello,

    This might be more of a PHP-thing than REGEX, but here's my problem:

    I am using a HEX value to find and replace 'white spaces' with 'x':
    take this example: [code=php]$string = preg_replace('/[\x{20}]/u', 'x', $string);[/code]

    But I want 'x' to be a HEX number that replaces '20', I have tried the following with no luck:
    [code=php]$string = preg_replace('/[\x{20}]/u', '\x{21}', $str...
    See more | Go to post
    Last edited by pbmods; Sep 21 '07, 12:18 AM. Reason: Changed [B] to [CODE=php].

  • to do the whole thing even easier use wx:

    Code:
    import wx
    
    app = wx.PySimpleApp()
    
    context = wx.ScreenDC()
    r, b = context.GetSize()
    
    # i have a second monitor left of my primary, so these value are negativ
    l, t = (-1280, -256) # coulfn't find a wx function to get these
    
    w, h = (r - l, b - t)
    bitmap = wx.EmptyBitmap(w, h, -1)
    
    memory = wx.MemoryDC()
    ...
    See more | Go to post

    Leave a comment:


  • and to save that file as jpg, png... you can use PIL:

    Code:
    bmpinfo = saveBitMap.GetInfo()
    print bmpinfo
    bmpstr = saveBitMap.GetBitmapBits(True)
    
    import Image
    im = Image.frombuffer('RGB', (bmpinfo['bmWidth'], bmpinfo['bmHeight']), bmpstr, 'raw', 'BGRX', 0, 1)
    #im.save('screencapture.jpg', format = 'jpeg', quality = 85)
    im.save('screencapture.png', format = 'png')
    See more | Go to post

    Leave a comment:


  • nobugus
    started a topic win32ui vs wxPy screen capture multi monitor

    win32ui vs wxPy screen capture multi monitor

    Just posting a solution to the problem of capturing the whole virtual screen area, including all monitors with python and pywin32.
    Because this doesn't work even with PIL's imagegrab module.

    Code:
    import win32gui,  win32ui,  win32con, win32api
    
    hwnd = win32gui.GetDesktopWindow()
    print hwnd
    
    # you can use this to capture only a specific window
    #l, t, r, b = win32gui.GetWindowRect(hwnd)
    ...
    See more | Go to post
No activity results to display
Show More
Working...