The error is caused due to mid evaluating to a float in Python 3.2 and 3.3 ..You may want to use prettyArgs.height() // 2 here.. or int(prettyArgs.height()/2)