Forum: Python Nov 13th, 2009 |
| Replies: 2 Views: 213 Try self.SetSizerAndFit(sizer) |
Forum: Geeks' Lounge Nov 13th, 2009 |
| Replies: 172 Views: 11,627 It is better to die for something than to live for nothing.
-- George S. Patton (US Army) |
Forum: Python Oct 19th, 2009 |
| Replies: 6 Views: 333 # staticmethod() and classmethod()
# make it easier to call one class method
class ClassA(object):
def test(this):
print this
test = staticmethod(test)
ClassA.test(4) # 4 |
Forum: Python Aug 25th, 2009 |
| Replies: 80 Views: 18,003 It's like putting single image on PyGame "liquid canvas" giving an eerie visual effect. Here is short code:
# PyGame liquid effect on single image
# just old PyGame example modified
# module... |
Forum: Python Aug 24th, 2009 |
| Replies: 3 Views: 414 niek_e is correct, successful compression depends on the source and the compression algorithm. Here is one example of large repeating text that the zip algorithm fails with, but bz2 compression... |
Forum: Python Aug 22nd, 2009 |
| Replies: 12 Views: 1,386 One rude awakening with Python3 will be the frequent use of bytearrays instead of strings. It does this to handle international unicode better.
Here is how you deal with this:
# get code of... |
Forum: Python Aug 13th, 2009 |
| Replies: 80 Views: 18,003 Retrieve the text from Tkinter Text widget line by line:
# explore the Tkinter Text() widget
# getting text 'line by line' from the widget
# use ctrl+c to copy, ctrl+x to cut selected text,
#... |
Forum: Python Aug 13th, 2009 |
| Replies: 80 Views: 18,003 In the previous example I meant 'Tkinter' rather than 'Tinter'. This however is PyQT example looking at the tooltip widget and some colored text:
# pqt_tooltip1.py
# exploring PyQT's tooltip and... |
Forum: Python Aug 6th, 2009 |
| Replies: 80 Views: 18,003 PyGame isn't the only toolkit you can use for animation. If you use Python 3.1 and still wait for PyGame to be available, you can use Tinter for some simple animations:
# Tk_CanvasMove1.py
#... |
Forum: Python Aug 5th, 2009 |
| Replies: 80 Views: 18,003 Put PyQT widgets on a color background using canvas:
# pqt_CanvasBackGround1.py
# use PyQT's paintEvent to create full frame canvas
# widgets will use the canvas as background
# Henri
import... |
Forum: Python Aug 5th, 2009 |
| Replies: 80 Views: 18,003 Look at PyQT's progress bar widget and simple timer to drive it:
# pqt_progressbar1.py
# explore PyQT's progress bar and simple timer widgets
# Henri
import sys
from PyQt4.QtCore import *... |
Forum: Python Aug 5th, 2009 |
| Replies: 80 Views: 18,003 Exampled code for PyQT's multiline text entry widget:
# pqt_TextEdit1.py
# explore PyQT's QTextEdit multiline text entry box
# click right mouse button in edit area for popup menu
# Henri
... |
Forum: Python Aug 5th, 2009 |
| Replies: 80 Views: 18,003 Sometimes it's nice to attach label to entry widget. One way to do this is with class object:
# pqt_EntryLab1.py
# create labeled data entry areas
# tested with Python 3.1 and PyQT 4.5
# Henri
... |
Forum: Python Aug 4th, 2009 |
| Replies: 80 Views: 18,003 Quick look at PyQT's QListWidget, commonly called 'list box'. Also shows how to create multiple buttons with the for loop. Here is short example:
# pqt_listbox2.py
# explore PyQT's QListWidget... |
Forum: Python Aug 3rd, 2009 |
| Replies: 80 Views: 18,003 One nice graphical way to select calendar date is with the calendar widget. Here is the PyQT example:
# explore the PyQT QCalendarWidget widget
# tested with Python 3.1 and PyQT 4.5
# Henri
... |
Forum: Python Jul 29th, 2009 |
| Replies: 80 Views: 18,003 One more simple way to present data in table form:
# use PyQT's QTableWidget, QTableWidgetItem and setItem
# to show data in simple table format
# tested with Python 3.1 and PyQT 4.5
# Henri
... |
Forum: Python Jul 28th, 2009 |
| Replies: 80 Views: 18,003 Exploring PyQT's QListView and QAbstractListModel. This little code pops up posssible words from word list as you type:
# using PyQT's QListView and QAbstractListModel
# to match partially typed... |
Forum: Python Jul 27th, 2009 |
| Replies: 80 Views: 18,003 Presenting data in the form of a table that can be sorted by column is slick, and relatively easy to do with PyQT's QTableView widget:
# use PyQT's QTableView and QAbstractTableModel
# to present... |
Forum: Python Jul 25th, 2009 |
| Replies: 80 Views: 18,003 Another look at PyQT's canvas:
# pqt_drawtext2.py
# playing with PyQT's QPainter
# setPen, setBrush, setFont, drawRect and drawText
import sys
# simpler import
from PyQt4.QtCore import *... |
Forum: Python Jul 25th, 2009 |
| Replies: 80 Views: 18,003 Looking at PyQT's grid layout manager:
# pqt_gridlayout1.py
# start of small calculator
import sys
# simple general import
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class... |
Forum: Python Jul 20th, 2009 |
| Replies: 80 Views: 18,003 The PyQT GUI toolkit's QLabel widget can actually display HTML formatted text directly. This allows for relatively easy formatting of text:
# PyQT's QLabel widget can display html formatted text
... |
Forum: Python Jul 19th, 2009 |
| Replies: 80 Views: 18,003 Similar to the PyQT GUI example above, the Thinter GUI toolkit also has input dialogs that validate the input:
# Python GUI toolkit Tkinter has 3 different data input dialogs:
#... |
Forum: Python Jul 19th, 2009 |
| Replies: 80 Views: 18,003 Just bought used Dell XP notebook for class work and installed Python 3.1 and then PyQT4 form:
http://www.riverbankcomputing.co.uk/software/pyqt/download
Windows installer (14JUL2009):... |
Forum: Geeks' Lounge Oct 17th, 2008 |
| Replies: 6 Views: 607 |
Forum: Geeks' Lounge Oct 3rd, 2008 |
| Replies: 25 Views: 2,073 Out of the corner of my tearful eye I noticed that I made my post #1000!
I am elated, exhilarated, jubilant, overjoyed, ecstatic and happy!
Time to get that 12 year old wine out of the cellar. |
Forum: Geeks' Lounge Sep 21st, 2008 |
| Replies: 487 Views: 35,637 Amazing, of all those articles only one is wrong! |
Forum: Python Jul 27th, 2008 |
| Replies: 130 Views: 50,213 Shows you how to drag one of wxPython's widgets with the mouse pointer:
# use mouse to drag the wx.Panel() widget
# wx.Panel(parent, id, pos, size, style)
import wx
class MyFrame(wx.Frame):
... |
Forum: Geeks' Lounge Jul 27th, 2008 |
| Replies: 45 Views: 4,351 |
Forum: Python Jul 3rd, 2008 |
| Replies: 130 Views: 50,213 Sneekula left one small starter editor somewhere around DaniWeb. So I took it and modified it to use the wxPython toolbar with icon images rather than Snee's menu bar. The images come from... |
Forum: Python Jun 10th, 2008 |
| Replies: 130 Views: 50,213 Well, if you do web-page designing, you will be familiar with the repeating image tile wallpaper. You can do something similar to give your wxPython frame or panel very sexy backgrounds. I leaned... |
Forum: Python Jun 10th, 2008 |
| Replies: 130 Views: 50,213 Nice stuff there Fuse and Ene!
Here is my contribution, showing you how easy it is to have wxPython display an image from image file:
# show .jpg .png .bmp or .gif image on wx.Panel
import wx
... |
Forum: Geeks' Lounge Mar 13th, 2008 |
| Replies: 8 Views: 853 Very fanny indeed!
My computer goes on slow down strike, and I have to stick money onto the CD tray to speed it up. |
Forum: Python Mar 3rd, 2008 |
| Replies: 3 Views: 2,653 You can do it with label and use spaces of the desired background colour. Here is example:
# Tkinter progress bar experiment
# using label and string of spaces
import Tkinter as tk
root =... |
Forum: Geeks' Lounge Nov 12th, 2007 |
| Replies: 4 Views: 901 Along the same vain:
----------- Church Bulletin Mistakes ----------
Our next song is "Angels We Have Heard Get High."
Don't let worry kill you -- let the church help.
Remember in... |
Forum: Geeks' Lounge Nov 4th, 2007 |
| Replies: 180 Views: 12,182 There are plenty of natives around that rob your stores and join gangs. On the other hand, who would keep your lawn looking nice, cook your food, wash your clothes, build your roads and houses? |
Forum: Python Jul 4th, 2007 |
| Replies: 3 Views: 1,280 The problem with time.sleep(sec) is that your whole program sleeps unless you thread the background action. So BearofNH's use of time.time() is more appropriate. |
Forum: Geeks' Lounge Jun 17th, 2007 |
| Replies: 30 Views: 2,190 I think that computer programming can be made exciting even with old languages like Qbasic. It's the dullfugg of a teacher that can bore the students out of their mind. |
Forum: Python Feb 19th, 2007 |
| Replies: 4 Views: 29,996 Sure Python has multidimensional arrays, they are called lists of lists or tuples of tuples etc.
mlist1 = [
[7, 12, 23],
[22, 31, 9],
[4, 17, 31]]
print mlist1 # [[7, 12, 23], [22, 31, 9],... |
Forum: Python Nov 7th, 2006 |
| Replies: 9 Views: 4,717 Expanding on mawe's formula builder, this is my contribution to the equation solver:
# evaluate equation like 3x^2+2(3x-2) = 0
import re
# look for digit before alpha and '('
pattern =... |
Forum: Python Oct 22nd, 2006 |
| Replies: 1 Views: 1,245 The two functions
num = input("Enter a number: ")
and
name = raw_input("Enter a name: ")
are for the user to enter number or name from the console.
Please use code tags. At end of your code... |