def random_wallpaper_files(directory, minnumber=0, maxnumber=100): """Generates random wallpaper files in the specified directory @returns: a list of filenames (the basenames including the extension) """ names=[gen_string(minlength=10, maxlength=50) for i in range(random.randrange(minnumber, maxnumber))] print "Generating",len(names),"wallpaper files" from wxPython.lib import colourdb colourdb.updateColourDB() colours=colourdb.getColourList() penstyles=[ wx.SOLID, wx.DOT, wx.LONG_DASH, wx.SHORT_DASH, wx.CROSS_HATCH ] types=[ (wx.BITMAP_TYPE_BMP, ".bmp"), (wx.BITMAP_TYPE_JPEG, ".jpg"), (wx.BITMAP_TYPE_PNG, ".png")] for n in range(len(names)): width=random.randrange(1,200) height=random.randrange(1,200) bitmap=wx.EmptyBitmap(width, height) mdc=wx.MemoryDC() mdc.SelectObject(bitmap) mdc.Clear() for i in range(random.randrange(1,200)): pen=wx.Pen(random.choice(colours), random.randrange(1,10), random.choice(penstyles)) mdc.SetPen(pen) mdc.DrawLine(random.randrange(0,width), random.randrange(0,height), random.randrange(0,width), random.randrange(0, height)) t,e=random.choice(types) names[n]=names[n]+e mdc.SelectObject(wx.NullBitmap) bitmap.SaveFile(os.path.join(directory, names[n]), t) print " ... generation complete" return names
def random_wallpaper_files(directory, minnumber=0, maxnumber=100): """Generates random wallpaper files in the specified directory @returns: a list of filenames (the basenames including the extension) """ names = [ gen_string(minlength=10, maxlength=50) for i in range(random.randrange(minnumber, maxnumber)) ] print "Generating", len(names), "wallpaper files" from wxPython.lib import colourdb colourdb.updateColourDB() colours = colourdb.getColourList() penstyles = [wx.SOLID, wx.DOT, wx.LONG_DASH, wx.SHORT_DASH, wx.CROSS_HATCH] types = [(wx.BITMAP_TYPE_BMP, ".bmp"), (wx.BITMAP_TYPE_JPEG, ".jpg"), (wx.BITMAP_TYPE_PNG, ".png")] for n in range(len(names)): width = random.randrange(1, 200) height = random.randrange(1, 200) bitmap = wx.EmptyBitmap(width, height) mdc = wx.MemoryDC() mdc.SelectObject(bitmap) mdc.Clear() for i in range(random.randrange(1, 200)): pen = wx.Pen(random.choice(colours), random.randrange(1, 10), random.choice(penstyles)) mdc.SetPen(pen) mdc.DrawLine(random.randrange(0, width), random.randrange(0, height), random.randrange(0, width), random.randrange(0, height)) t, e = random.choice(types) names[n] = names[n] + e mdc.SelectObject(wx.NullBitmap) bitmap.SaveFile(os.path.join(directory, names[n]), t) print " ... generation complete" return names
#--local includes -- from datatier import DataTier from resistornet import MaxRect, EnlargeRect, GenRect from graph import SolveRNet, MultGraph from undoqueue import * ############################################################################## # HAUPTPROGRAMM ############################################################################## clrList=colourdb.getColourList() ###### KONSTANTEN GUI ######################################################## ID_NEW = wxNewId() ID_SAVE = wxNewId() ID_LOAD = wxNewId() ID_PRINT= wxNewId() ID_QUIT = wxNewId() ID_UNDO = wxNewId() ID_REDO = wxNewId() ID_DRAW_R = wxNewId() ID_DRAW_L = wxNewId()