Search Results

Showing results 1 to 40 of 52
Search took 0.06 seconds.
Search: Posts Made By: sneekula ; Forum: Python and child forums
Forum: Python 6 Days Ago
Replies: 130
Views: 50,718
Posted By sneekula
I modified the code in the previous post to join two images into one:
# use a drawing bitmap and wx.MemoryDC to create a canvas you can
# draw on and optionally save the drawing to an image file
#...
Forum: Python 7 Days Ago
Replies: 27
Views: 699
Posted By sneekula
If there is no space in the rank or name you can do it this simple way:
mydata = """\
<Ranking: AA (John)>
<Ranking: CA (Peter)>
<Ranking: TA-A (Samantha)>
"""

rank_list = []
for line in...
Forum: Python Nov 7th, 2009
Replies: 130
Views: 50,718
Posted By sneekula
Just testing wxPython's wx.TextCtrl widget used as an edit field for input and output of text based data:
# testing wxPython's
# wx.TextCtrl(parent, id, value, pos, size, style)
# a widget used...
Forum: Python Sep 21st, 2009
Replies: 9
Views: 417
Posted By sneekula
I made an attempt on user friendly data entry with just such a simple temperature converter program, see:
http://www.daniweb.com/forums/post992595.html#post992595
Forum: Python Sep 21st, 2009
Replies: 197
Read Me: Starting Python
Views: 89,462
Posted By sneekula
The ultimate user friendly Temperature Converter program. If you put an 'F' or 'f' on the end of the temperature you enter it will give you Celsius. Otherwise it simply assumes you entered a...
Forum: Python Sep 17th, 2009
Replies: 130
Views: 50,718
Posted By sneekula
Just a quick example on how to use the wx.grid.PyGridTableBase with wxPython's wx.grid.Grid. Provides a simple way to create, load and use a spreadsheet like grid:
# exploring wxPython's...
Forum: Python Sep 15th, 2009
Replies: 80
Views: 18,606
Posted By sneekula
Yes Gloria, Tkinter has a combo box, but it's called an option menu. Here is an example:
# using Tkinter's Optionmenu() as a combobox

try:
# Python2
import Tkinter as tk
except...
Forum: Python Sep 13th, 2009
Replies: 3
Views: 888
Posted By sneekula
You have to read up on the slicing operator in the Python Manual.

Generally you can slice a sequence with [start: end: step]
By default start=0, end=len(seq), step=1
step=-1 goes from the end to...
Forum: Python Aug 31st, 2009
Replies: 4
Views: 301
Posted By sneekula
Courier is the most common font to space all character equal.
Forum: Python Aug 21st, 2009
Replies: 2
Solved: tkFileDialog
Views: 316
Posted By sneekula
Take a quick look at:
http://www.daniweb.com/forums/showpost.php?p=954810&postcount=53
Forum: Python Aug 21st, 2009
Replies: 80
Views: 18,606
Posted By sneekula
Just a basic text editor written with the Tkinter GUI toolkit:
# a very simple Tkinter editor
# shows you how to create a menu and
# use the file dialog to read and write files of text data
#...
Forum: Python Aug 19th, 2009
Replies: 80
Views: 18,606
Posted By sneekula
The Tkinter drawing canvas can be fun. Here are two short programs that can be used by an artist for creative things:
# draw a circle with center (x, y) and fixed radius at
# each mouse (x, y)...
Forum: Python Aug 19th, 2009
Replies: 80
Views: 18,606
Posted By sneekula
If you have young children at home, or are yourself a young child at heart, there is a delightful Python module called frog, that does turtle like drawings and more:
# frog is a somewhat advanced...
Forum: Python Aug 18th, 2009
Replies: 6
Views: 341
Posted By sneekula
How about a blank icon as a spacer? Or maybe just a label with a few spaces?
Forum: Python Aug 14th, 2009
Replies: 80
Views: 18,606
Posted By sneekula
Here is a basic template of a window, 2 buttons and a label using the pygtk toolkit:
# a very basic pygtk window template
# with two buttons and one label
# snee

import pygtk...
Forum: Python Aug 13th, 2009
Replies: 80
Views: 18,606
Posted By sneekula
Here is an example of a scrolled Tkinter canvas to display a series of drawn objects or pictures:
# example of a Tkinter scrolled canvas class
# snee

try:
# for Python2
import Tkinter...
Forum: Python Aug 11th, 2009
Replies: 3
Views: 287
Posted By sneekula
Set up a formatted string before you send it to the Textbox. Here is an example:
# example to set up a table formatted string

import math

# set up the format strings (use - for left...
Forum: Python Aug 8th, 2009
Replies: 3
Views: 275
Posted By sneekula
In Python most everything is an objects, so you are using OOP from the start.
If you talking about the use of classes, then basically you have another tool to organize larger programs.

You can...
Forum: Python Aug 1st, 2009
Replies: 80
Views: 18,606
Posted By sneekula
For those of you who want experience vegaseat's sweet Tinter tkk example at:
http://www.daniweb.com/forums/post921416-25.html
on your Linux machines, in my case Ubuntu (Python 3.1 is not in the...
Forum: Python Aug 1st, 2009
Replies: 80
Views: 18,606
Posted By sneekula
Some options with a basic Tkinter window:
# set position and size of a Tkinter window

try:
# for Python2
import Tkinter as tk
except ImportError:
# for Python3
import tkinter...
Forum: Python Jul 25th, 2009
Replies: 80
Views: 18,606
Posted By sneekula
Since Pygame does not have a file dialog, we can use Tkinter's file dialog and withdrawing the root so it doesn't clash with Pygame's eventloop:
# experiments with module pygame
# free from:...
Forum: Python Jun 22nd, 2009
Replies: 197
Read Me: Starting Python
Views: 89,462
Posted By sneekula
In the English language you can add a suffix to a number, so for instance first becomes 1st, second 2nd, third 3rd, fourth 4th and so on. Here is a little Python program that does it for you, and...
Forum: Python Jun 20th, 2009
Replies: 80
Views: 18,606
Posted By sneekula
An example how to use an image as a background. In order to make added text transparent, use the Tkinter canvas:
# use a Tkinter canvas for a background image
# add transparent text and other...
Forum: Python Jun 17th, 2009
Replies: 9
Views: 1,018
Posted By sneekula
Beauty and henceforth ugly is in the eye of the beholder!

Actually, the QT_Designer is pretty good and gives XML code that can be converted to a seemingly complex looking Python code.
Forum: Python May 19th, 2009
Replies: 9
Views: 576
Posted By sneekula
The easiest way is to use a wx.RadioBox:
import wx

class MyFrame(wx.Frame):
def __init__(self, parent=None):
wx.Frame.__init__(self, parent, wx.ID_ANY, size=(300, 160))
#...
Forum: Python May 15th, 2009
Replies: 80
Views: 18,606
Posted By sneekula
The nice thing about using a GUI toolkit is that you have a large number of widgets available to supply the data input. Here is a Tkinter Temperature Converter example using radio buttons to select...
Forum: Python May 13th, 2009
Replies: 12
Views: 853
Posted By sneekula
The easiest way is to create a dictionary where the key is the (x,y) location tuple and the value is the (r,g,b) color tuple of the pixel:
#!/usr/bin/env python

# image data analysis using PIL,...
Forum: Python May 13th, 2009
Replies: 80
Views: 18,606
Posted By sneekula
Tkinter has the reputation to look kind of homely on Windows computers. Actually, on my Ubuntu/Linux computer it doesn't look bad at all. Here is a typical listbox example using the Tkinter GUI...
Forum: Python May 10th, 2009
Replies: 80
Views: 18,606
Posted By sneekula
Here is a comparison of some common Python GUI toolkits. These were created on my Ubuntu/Linux machine, because I could never get PyGTK to go on my Windows Vista machine. I followed the...
Forum: Python Apr 9th, 2009
Replies: 6
Views: 950
Posted By sneekula
One of your problems is that you named the button and the function the same! Name your button "button_update" or something.

Other problems are the '\' in Label and that name is not assigned a...
Forum: Python Mar 21st, 2009
Replies: 3
Views: 518
Posted By sneekula
Here is another option to help Python to locate custom modules in custom directories:

If you want to import custom module xyq via the Pythonpath
create a file xyq.pth and stick it into a...
Forum: Python Mar 17th, 2009
Replies: 7
Views: 428
Posted By sneekula
I assume you mean something simple like this:
# extract the numeric value before the word 'DIFFERENCES'

text = """\
FILE A HAS 2266 LINES OF WHICH 951 WERE IGNORED
FILE B HAS 2193 LINES OF...
Forum: Python Jan 14th, 2009
Replies: 16
Views: 1,674
Posted By sneekula
I got curious, so I timed the 'just Python' and 'module re' approaches:
# timing characer count by type
# compare 'module re' and 'just Python' approches

import timeit
import re

def...
Forum: Python Jan 4th, 2009
Replies: 5
Views: 506
Posted By sneekula
Re: Why does it make another file with the ending ".Pyc" at the end?

When you saved your class module as awclassPet.py, then Python will also create a compiled bytecode version of this file the...
Forum: Python Dec 23rd, 2008
Replies: 130
Views: 50,718
Posted By sneekula
The wx.RichTextCtrl() widget allows the user to create formatted text with color, size, font, bullets, images and more:
# experiment with wxPython's
# wx.RichTextCtrl(parent, id, value, pos, size,...
Forum: Python Oct 29th, 2008
Replies: 8
Views: 928
Posted By sneekula
Oh sweet Jesus! Years ago they used to pester us with stuff like this. C syntax can be real ugly, and your example is one of the best examples of ugly C syntax.
Forum: Python Aug 25th, 2008
Replies: 130
Views: 50,718
Posted By sneekula
I was trying to create an alternative calculator using some of wxPython's input widgets like wx.Choice and wx.TextCtrl. This turned out to be a good example for the wx.GridBagSizer too. The basic...
Forum: Python Aug 17th, 2008
Replies: 9
Views: 704
Posted By sneekula
Add the line
number1 = number2 = number3 = number4 = number5 = number6 = 0
right below the line
counter = counter +1

This way your line 64 does not mix up the possible answers and Python knows...
Forum: Python Jul 16th, 2008
Replies: 130
Views: 50,718
Posted By sneekula
A nice looking informative about-box is easy to achieve with the wx.AboutBox() widget. The example also touches on menu construction and wxPython's wordwrap feature:
# testing the fancy...
Forum: Python Jul 16th, 2008
Replies: 130
Views: 50,718
Posted By sneekula
I was playing around with wxPython's slider widget and found a nice application for it:
# use slider inputs to calculate cost of petrol in the USA and Europe

import wx

class MyFrame(wx.Frame):...
Showing results 1 to 40 of 52

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC