随笔分类 -  Python

摘要:# PIL- The `Image` class is just a wrapper for the internal `ImagingCore` type([ref](http://code.activestate.com/lists/python-image-sig/205/)) 阅读全文
posted @ 2015-04-04 19:27 n0p 阅读(153) 评论(0) 推荐(0)
摘要:> sudo apt-get install python-opencv> cp /usr/lib/python2.7/dist-packages/cv2.so /opt/anaconda/lib/python2.7/site-packages/or > conda install -c https... 阅读全文
posted @ 2015-03-26 16:52 n0p 阅读(751) 评论(0) 推荐(0)
摘要:1 from Tkinter import * 2 import ttk 3 import threading 4 import random 5 import time 6 7 class PgBarFrm(Frame): 8 def __init__(self, root, max_len): 9 self.root = root10 Frame.__init__(self, root)11 12 self.pb_val = IntVar() # pbar variable13 self.pb_max = max... 阅读全文
posted @ 2013-04-24 17:14 n0p 阅读(614) 评论(0) 推荐(0)
摘要:GUI用的是Tkinter,在主线程执行,子线程是工作线程"""ttk.Progressbar demo, with multi-threadingauthor: nn0p data: 2013.04.24"""from Tkinter import *import ttkimport threadingimport randomimport timeclass UIThread: def __init__(self, root, count=10): self.count = count self.value = 0 self.b_ 阅读全文
posted @ 2013-04-24 13:30 n0p 阅读(4536) 评论(0) 推荐(0)
摘要:IPython supplies you the convenience of editing code from command prompt, the magic command %edit. However in Windows it will use notepad as default editor which is not suitable for editing python source code. Here is the method to config the editor option.As IPython official doc said:Editor configu 阅读全文
posted @ 2013-04-02 13:00 n0p 阅读(1634) 评论(0) 推荐(0)
摘要:With importing the model, the methods mainly depends on the os.path model:# method 1import _module_print _module_.__file__ # method 2import os.path print os.path.abspath(_module_.__file__) print os.path.dirname(_model_.__file__) # method 3import sys sys.modules['_model_']Without importing th 阅读全文
posted @ 2013-04-02 10:57 n0p 阅读(212) 评论(0) 推荐(0)
摘要:In python, class and instance are both objects.<Learning Python> says that,When we run a class statement, we get a class object.When we call a class object, we get an instance object.Such confusing definitions. 阅读全文
posted @ 2013-04-02 00:11 n0p 阅读(155) 评论(0) 推荐(0)
摘要:Python3.x新特性一、装了一个Python3.0(win环境下),写了个hello world测试print 'hello world'用IDLE运行的时候,结果报错: invalid syntax查了一下资料才知道3.0竟然与2.x版的语言不兼容,需要print ('hello world'),真是太假了,那群SB竟然这样改!人家C++还向C兼容,python竟然版本都不兼容了!!二、What's new in Python3.0更详细的介绍请参见python3.0的文档Common Stumbling Blocks本段简单的列出容易使人出错的变 阅读全文
posted @ 2012-11-18 22:13 n0p 阅读(311) 评论(0) 推荐(0)