4,305 Posted Topics

Member Avatar for tech291083
Member Avatar for Salem
0
2K
Member Avatar for tomtetlaw

Generally its done this way ... [code=python]import pygame # optional pygame.init() # create the screen (or pygame window) screen = pygame.display.set_mode((800, 600)) # fill the screen black (default) screen.fill((0, 0, 0)) # pick an image you have (.bmp .jpg .png .gif) # if the image file is not in the …

Member Avatar for tomtetlaw
0
2K
Member Avatar for StarZ

[QUOTE=BearofNH;749071]That doesn't square with what you said in the original post ... you know ... the part that reads "I can't seem to figure it out." For all I know, English isn't your native language. Just wanted to make sure we start out with common definitions. Also it appears you …

Member Avatar for vegaseat
0
160
Member Avatar for kiddo39

Played around with it a little ... [code=python]# use PIL to count pixels in letters I and O # image file needs to be a bitmap file to maintain # red (255,0,0) and black (0,0,0) pixel colors correctly from PIL import Image # img_I.bmp --> 50x50 black bg + red …

Member Avatar for vegaseat
0
2K
Member Avatar for Nanz

Not sure if I follow this correctly, but you start with a one dimensional list and append other lists to it. For example ... [code=python]qq = [] for row in range(3): for col in range(3): qq.append([row, col]) print qq """ my output --> [[0, 0], [0, 1], [0, 2], [1, …

Member Avatar for jlm699
0
63K
Member Avatar for MaracKoMarac

Let me rewrite your code a little to illustrate this ... [code=python]from Tkinter import * master = Tk() def draw_circle(event): x1 = event.x y1 = event.y x2 = x1 + 10 y2 = y1 + 10 # note that c1 is simply a numeric id c1 = cv.create_oval(x1, y1, x2, …

Member Avatar for MaracKoMarac
0
121
Member Avatar for marketingworld
Member Avatar for xinix

In Dev-C++ go File > New > Project > Console Application > give the project a name > OK > create a directory, open it and save the .dev file there. A skeleton file comes up, flesh this one out with your code. The skeleton file has system("PAUSE") and the …

Member Avatar for VernonDozier
0
2K
Member Avatar for Stefano Mtangoo

Catch 22 here, the various operating system backends are used (auto-detected) to make the media controls work cross platform.

Member Avatar for Stefano Mtangoo
0
90
Member Avatar for sneekula

Normally the free market balances things out, but when the the Federal Reserve Banking System in the US comes in with ridiculously low interest rates, that are less the half the inflation rate, things turn unreal and unbalanced. The banks are sitting on so much freshly printed money that they …

Member Avatar for GrimJack
0
368
Member Avatar for dseto200

There is an English dictionary file attached to: [url]http://www.daniweb.com/forums/post160495-8.html[/url] The file contains one English word per line, so pick one at random.

Member Avatar for woooee
0
2K
Member Avatar for allena
Member Avatar for dseto200

Use the slicing operators defaults and -1 as the step ... [code=python]# slicing operator seq[begin : end : step] # defaults are index begin=0, index end=len(seq)-1, step=1 # -begin or -end --> count from the end backwards # step = -1 reverses sequence message = raw_input ("Enter any message...")[::-1] print …

Member Avatar for dseto200
0
225
Member Avatar for rastaberry

If I read your question correctly, you are thinking about something like that ... [code=python]# create a string of random '0' and '1' characters # then replace '0' with '001' and '1' with '010' import random size = int(raw_input("How long should the string be?")) # only the characters in the …

Member Avatar for rastaberry
0
88
Member Avatar for goldsm

Where it shows includes = ['PIL'], try to replace 'PIL' with 'PYOpenGL3' or whatever your import module is ... [code=python]# Py2Exe version 0.6.9 setup file for console programs. # # If this is a windows GUI application replace the last line with # windows = [{"script": 'myFile.py'}] ) # # …

Member Avatar for vegaseat
0
91
Member Avatar for ccandillo

Classes don't make functions obsolete. The beauty of Python is that you can go either way. It's up to you, if a class makes sense, use it. I use classes in most GUI programs, using inheritance is very common. Also, the program looks more organized and simply makes life easier.

Member Avatar for Stefano Mtangoo
0
143
Member Avatar for Lardmeister

I am not sure if the vice president makes such a difference, as long as he/she doesn't suffer from "foot in mouth" disease.

Member Avatar for jbennet
0
3K
Member Avatar for wangzi
Member Avatar for wangzi
0
97
Member Avatar for Stefano Mtangoo
Member Avatar for Stefano Mtangoo
0
139
Member Avatar for Devlan

You really should use module pickle for that ... [code=python]# use module pickle to save/dump and load a dictionary object # or just about any other intact object import pickle # create the test dictionary before_d = {} before_d[1]="Name 1" before_d[2]="Name 2" before_d[3]="Name 3" # pickle dump the dictionary fout …

Member Avatar for vegaseat
0
124
Member Avatar for Lardmeister
Member Avatar for markmcwiggins

If you are using wx.grid.Grid, there is an example here: [url]http://www.daniweb.com/forums/post666940-59.html[/url]

Member Avatar for vegaseat
0
97
Member Avatar for Lum1n0us

To do this you will have to adapt your code to a modified Python called Cython or Pyrex. See: [url]http://wiki.cython.org/[/url] For smaller projects you can also look into the Boo language that uses Python like syntax and connects to the .NET C# compiler. For an example of the Boo language …

Member Avatar for vegaseat
0
450
Member Avatar for The Dude

If you do reseaarch on global warming, it will be very difficult to get funding, if you do not subscripe to the 'gorist' junk science view of things. As jwenting says, this view has been elevated to the status of a religion.

Member Avatar for Dave Sinkula
0
973
Member Avatar for vmars

On Windows systems Python uses wx core DLLs written in C++, together with PYD files (similar to DLLs) and just plain old Python code, you might call these wrappers, to do its magic.

Member Avatar for vegaseat
0
108
Member Avatar for MaxVK

I think we had that just a few weeks ago, anyway here is an example how to do this ... [code=python]# create two frames with wxFrame, only one is showing import wx class Frame1(wx.Frame): def __init__(self, parent, mytitle): wx.Frame.__init__(self, parent, wx.ID_ANY, mytitle) self.SetBackgroundColour("green") # pass frame1 to frame2 as instance …

Member Avatar for MaxVK
0
624
Member Avatar for The Dude

Latest news in Tennesee: Another two nut cases with a car full of guns were caught planning to shoot Barack Obama.

Member Avatar for hughv
0
277
Member Avatar for SaltAndBatterie

Wonderful footage! The Israeli police should have simply allowed them fight and let the winner take all! :)

Member Avatar for GrimJack
0
131
Member Avatar for GrimJack
Member Avatar for SaltAndBatterie

Dubya already has a Scottish Terrier named Barney. What is it with names starting with a B? So Blair would be Poodle #1 and Brown would be Poodle #2 at best. I guess the reference to the dog was the humour portion of Obama's news conference, since he refers to …

Member Avatar for vegaseat
0
120
Member Avatar for Ancient Dragon
Member Avatar for steven woodman

GrimJack, finally a good use of the otherwise wasted space above our highways. Looks like the old eggbeater windmills should work well and could even be mass produced by our sluggish car manufacturers.

Member Avatar for sneekula
0
2K
Member Avatar for sneekula

Britain is still paying off debts that predate the Napoleonic wars because it's cheaper to do so than buy back the bonds on which they are based.

Member Avatar for Ene Uran
1
498
Member Avatar for sneekula

I heard this from a 120% Republican: [QUOTE]The US Postal Service created a stamp with a picture of President Bush to honor his achievements. In daily use it was shown that the stamp was not sticking to envelopes. After a month's testing, a special presidential commission made the following findings: …

Member Avatar for Ene Uran
0
1K
Member Avatar for Lardmeister

[QUOTE=GrimJack;722699]No wonder she crashed - she was on the broom backwards.[/QUOTE]You know in all my years I have never learned how to fly a broom properly!

Member Avatar for sneekula
0
765
Member Avatar for Byron Warren
Re: Hi

Hello Byron! I would like to ask you to play real well on your electric bass guitar. :)

Member Avatar for Doctor Inferno
0
40
Member Avatar for ZZucker

If a deaf person has to go to court, is it still called a hearing?

Member Avatar for Lardmeister
0
1K
Member Avatar for mathijs

Take a look at this wxPython code example at: [url]http://www.daniweb.com/forums/post627032-17.html[/url] It shows you how to use an image as a background to put widgets on. In general, pygame is more applicable for games, but there aren't as many example here on DaniWeb.

Member Avatar for mathijs
0
601
Member Avatar for vmars

tyincali explained that very nicely. [QUOTE]And is 'background.SetSizer(verticalBox)' saying verticalBox is parent of background? [/QUOTE]You are simply setting the main sizer, background is still the parent. Remember that the first object inside the () is not necessarily the parent. In your case only the widgets have a parent argument: wx.Frame(parent, …

Member Avatar for vegaseat
0
193
Member Avatar for anand.cgg
Member Avatar for Denniz
0
51
Member Avatar for vmars

Hello Vernon, and welcome to the Python forum. We are a small, but growing number of Pythonians, Pythononistas and Pythonurus. I see you didn't waste much time and already posted on the forum. Hope you enjoy programming in Python as much as I do.

Member Avatar for vegaseat
0
132
Member Avatar for imcrackinup3

Take a look at ... [url]http://www.daniweb.com/forums/post723559-152.html[/url] ... to learn a few things about turtle drawing.

Member Avatar for vegaseat
0
79
Member Avatar for dem10

I think you might mean this: [code=python]# access count using a bookie or helper function # (code from G-Do) def bookie(func): """helper function""" func.count += 1 def f3(): bookie(f3) # your code goes here f3.count = 0 for k in range(10): f3() print "Function f3() has been accessed", f3.count,"times" """ …

Member Avatar for shadwickman
0
175
Member Avatar for liquoriser21

My first PC had an RCA CMOS elf chip used by NASA in those days. Used to program in machine code, assembler, Forth, Basic, C, Pascal (Delphi), and now mostly Python. Yes, it has taken up many hours of my life, but it has not taken over.

Member Avatar for vegaseat
0
239
Member Avatar for lllllIllIlllI

I have played around with VPython, looks like I have to do some more. Here are some of my favorite programs ... [code=python]# experiments with visual Python (VPython) # free download from http://vpython.org # bounce a ball on the floor (no wind resistance) # drag the right mouse button to …

Member Avatar for ZZucker
0
527
Member Avatar for leegeorg07

I think the game is also called "Tic Tac Toe" just take a look at: [url]http://en.literateprograms.org/Tic_Tac_Toe_(Python)[/url] It goes through great detail how to create a simple game.

Member Avatar for shadwickman
0
104
Member Avatar for danfi766
Member Avatar for Stefano Mtangoo

Ene, you are using global instances, so the frame.panel1 or frame.panel2 reference is actually not needed. You can just use panel1 and panel2. However, your approach keeps things together.

Member Avatar for Stefano Mtangoo
0
101
Member Avatar for duuchkan_2
Re: Hi

Good day! Don't be shy, let us know a bit more about yourself. Technical stuff, hobbies, whatever. Should you use or want to use Python, visit the Python forum here. [url]http://www.daniweb.com/forums/forum114.html[/url] or ... [url]http://www.daniweb.com/forums/thread20774.html[/url]

Member Avatar for IMtheBESTatJAVA
0
28
Member Avatar for Zeek.

Zeek welcome to our friendly web site. Being new to computer programming you might like to acquaint yourself with a great starting language called Python. Visit the Python forum here. [url]http://www.daniweb.com/forums/thread20774.html[/url]

Member Avatar for Dani
0
286

The End.