4,305 Posted Topics

Member Avatar for vegaseat

Does anybody know the limit of nested for loops in C or C++? If there is a limit, what is the reason?

Member Avatar for Narue
0
212
Member Avatar for ankit_rastogi82

This works just as expected ... [php]mainstr =""" ${if:isLeaf} Dont include this isLeaf=True ${/if:isLeaf} ${if:isStatic} include this isStatic=True ${/if:isStatic} """ substr = """ ${if:isLeaf} Dont include this isLeaf=True ${/if:isLeaf} """ print mainstr.replace(substr, "") """ result = ${if:isStatic} include this isStatic=True ${/if:isStatic} """ [/php]

Member Avatar for vegaseat
0
185
Member Avatar for ankit_rastogi82

Hmm, got some goofy funny faces in your code and reworked it a little. Is this still correct? [code]""" I want all the start and end indices of the string but re.search() returns the first regex met in the string. re.match() also wont work because it search in the begining. …

Member Avatar for ankit_rastogi82
0
148
Member Avatar for k_en

Mawe is right! Using Python keywords as variable names in your code can lead to nasty errors. Otherwise your code should work the following way ... [php]# test list1 = range(10) alpha = range(10, 0, -1) print list1 # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] print …

Member Avatar for k_en
0
121
Member Avatar for k_en

There are two ways to do this ... [php] # older way, needs to import string module import string sentence = "HOW ARE YOU" newS = string.lower(sentence) print newS # newer way, no import needed newerS = sentence.lower() print newerS [/php]

Member Avatar for k_en
0
186
Member Avatar for Micko

Micko, good luck in your new job. I have enjoyed your interesting problems.

Member Avatar for vegaseat
0
165
Member Avatar for bucodi

wx.TextCtrl does not have a member/method SetFocus() and has to get it from it's parent like a wx.Frame or wx.Panel. So put the wx.TextCtrl on a wx.Panel or wx.Frame and it will work! [php]# 3 editboxes on a frame import wx class MyFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, 'wx.TextCtrl and …

Member Avatar for vegaseat
0
1K
Member Avatar for bucodi

Put the controls on a Panel and then you can use for instance: control3.SetFocus()

Member Avatar for vegaseat
0
140
Member Avatar for Micko
Member Avatar for HolyBull

I am impressed, you really did your homework on this! The Toshiba is an attention getter with the twist display! I am more inclined to get a notebook for around $700 that does what I want it to do. The technology gets outdated so fast, that I rather replace the …

Member Avatar for MartyMcFly
0
121
Member Avatar for shanenin

Freevo is only for Linux, can't get GTK to go on Windows, I feel like I am drowning in a Microsoft induced quagmire! Did anybody ever look at IronPython (Python for .NET)? Am I off, or is this nothing but a crock of dung? Me in a bad mood? Heck …

Member Avatar for vegaseat
0
234
Member Avatar for Avner .H.

I thought you loaded the combobox this way: [code]comboBoxEntry.entry.set_text("String1") # or slist = [ "String1", "String2", "String3", "String 4" ] comboBoxEntry.set_popdown_strings(slist) [/code]

Member Avatar for vegaseat
0
212
Member Avatar for Avner .H.

I think this should work ... [php]# get the string str1 = combo.entry.get_text() # process the string str1 # then put it back combo.entry.set_text(str1) [/php] Avner, you seem to get gtk to work, all I ever get is a pango.dll error. So you are way ahead of me!

Member Avatar for Avner .H.
0
172
Member Avatar for Avner .H.

I am scratching my head on this. Can you enlighten us a little more? A small code example would help.

Member Avatar for vegaseat
0
94
Member Avatar for Micko

Since the frame is empty and you are not packing it into the root, my IDE ignores it, no errors. Your IDE may have a lint filter built in and looks at this as uncompleted code! This would be the more normal way to do something with a frame ... …

Member Avatar for Micko
0
376
Member Avatar for PKort

I am surprised that Mandriva Linux doesn't come with wxPython already installed. Maybe the LE version is lacking it. You may want to sign up at: [url]http://www.mandrivaexpert.com/index1.php[/url] and ask them for the details.

Member Avatar for shanenin
0
150
Member Avatar for Micko

You simply use tuple packing ... [php]a = 1; b = 2; c = 3 # swap a with b a, b = b, a # now b = 1 and a = 2 # multiple swaps a, b , c = b, c, a # now b = 1 …

Member Avatar for Micko
0
3K
Member Avatar for bumsfeld

For labels you have to use SetForegroundColour ... [code]import wx class MyPanel(wx.Panel): def __init__(self, parent, id): wx.Panel.__init__(self, parent, id) str1 = "Camembert cheese is the best!" self.label1 = wx.StaticText(self, -1, str1 , wx.Point(15, 30)) self.label2 = wx.StaticText(self, -1, str1 , wx.Point(15, 50)) self.label2.SetBackgroundColour("yellow") # use SetForegroundColour() and not SetTextColour() self.label2.SetForegroundColour("blue") …

Member Avatar for vegaseat
0
901
Member Avatar for danizzil14

When you download wxPython2.6-win32-unicode-2.6.1.0-py24.exe from: [url]http://prdownloads.sourceforge.net/wxpython/[/url] also download wxPython2.6-win32-docs-demos-2.6.1.0.exe Install both. In the docs/demo folder is a program main.py that brings up a nice selection of examples, the closest thing I could find that looks like a wxPython tutorial. It runs the demos, shows the code and gives an explanation. …

Member Avatar for vegaseat
0
416
Member Avatar for leb

I have tried to play mp3, mid and ogg files with Pygame. The help on the mixer seems to indicate that this should be possible. However I get messages that the SDL_mixer.dll that ships with pygame-1.7.1.win32-py2.4.exe is not the new version. I assume you have looked at the AudioServer.py example …

Member Avatar for bumsfeld
0
190
Member Avatar for bumsfeld

Yes, wxPython has a a method called GIFAnimationCtrl in the module wx.animate that will do just that. I think it is relatively new, available in the latest version 2.6 of wxPython. It works well and I posted a small code snippet at: [url]http://www.daniweb.com/code/snippet435.html[/url]

Member Avatar for vegaseat
0
171
Member Avatar for bumsfeld

There is a story behind Boo. A gifted programmer in Brazil developed applications in Python and then rewrote them in C# for distribution. Python code is short and easy on the eye, alas C# is extremely verbose and type declarations are dogmatic, almost fascistic. It was easier to develop a …

Member Avatar for Dani
0
301
Member Avatar for bumsfeld

The beauty of the PMIDI module is that you can produce sound, be it music or soundeffects, within your program with a few lines of code. This way you don't have to load a number of wave files (.wav) that are typically between 5k and 250k in size. Here is …

Member Avatar for vegaseat
1
244
Member Avatar for shanenin

I have seen something similar when I mixed GUI with a few test prints. Python must internally prioritize, maybe has something to do with the internal memory manager.

Member Avatar for vegaseat
0
148
Member Avatar for johnpaul
Member Avatar for pty
0
200
Member Avatar for atrusmre

Should be very similar to adding items to a listbox. Check out code snippet: [url]http://www.daniweb.com/code/snippet79.html[/url]

Member Avatar for atrusmre
0
2K
Member Avatar for vegaseat

I parked a little code snippet called "A Taste of Boo" at: [url]http://www.daniweb.com/code/snippet429.html[/url] It's under Python so the code field would show the indentations properly.

0
90
Member Avatar for danizzil14

The module shutil has copy(from, to) and move(from, to) for your file operations.

Member Avatar for vegaseat
0
216
Member Avatar for danizzil14

It might depend on what OS you are using, but here is one way ... [php]# socket.getaddrinfo returns a list of tuples # tuple[4][0] of each list element is the IP address import socket addrs = socket.getaddrinfo(socket.gethostname(), None) for addr in addrs: print addr[4][0] [/php]

Member Avatar for shanenin
0
481
Member Avatar for Avner .H.

The C based source of Gnome Druid (the Gnome wizard) is located at: [url]http://cvs.gnome.org/viewcvs/gnome-druid/[/url] Since Gnome is a Unix thing, I am not of much help.

Member Avatar for vegaseat
0
196
Member Avatar for tdizzle342

If you have Windows and Dev-C++ then you are in luck. Look at the code snippet: [url]http://www.daniweb.com/code/snippet122.html[/url] This might be a little overkill since it allows you to set the font, wordwrap and more. Trim it back to what you need!

Member Avatar for tdizzle342
0
300
Member Avatar for smicer

You could embed Python code in C++ and do the calculations with Python. 100+ digit integers are no problem. There is a little code snippet about the embedding of Python code into Dev-C++ at: [url]http://www.daniweb.com/code/snippet387.html[/url]

Member Avatar for Lerner
-1
153
Member Avatar for atrusmre
Member Avatar for simon126
Member Avatar for bumsfeld

The only function I know that you can give a sound frequency to is winsound.Beep(frequency, duration), and it may only work on Windows machines. The sound goes to the internal speaker, hence the word beep. WxPython and PyGame both have sound functions, but you have to supply them with a …

Member Avatar for vegaseat
0
650
Member Avatar for c_shaft05

Is the picture you are loading smaller than what you want to display? If yes, the quality will suffer quite a bit! The program has to make up missing information. Are you using the Python Image Library PIL for this?

Member Avatar for vegaseat
0
1K
Member Avatar for bumsfeld

I looked around in my toolbox and found some odds and ends. I combined what I found and wrote a little code snippet on the wx.Slider(), hope it helps. [url]http://www.daniweb.com/code/snippet403.html[/url]

Member Avatar for bumsfeld
0
496
Member Avatar for shanenin

Does it use SetBackgroundColour()? This may work on Windows only, I know some widgets like the wxMenuItem do have that caveat. Not quite sure about labels like wxStaticText. Should that be the case, then you have to go to rectangles, brush colors or floodfills.

Member Avatar for shanenin
1
190
Member Avatar for shanenin

This looks like a very old version. It might be worthwhile to download the latest version boa.0.4.4 and install it. That version has been updated for xwPython26 and wx namespace compliance. Also uses Python24 goodies.

Member Avatar for vegaseat
0
352
Member Avatar for bumsfeld
Member Avatar for G-Do
0
366
Member Avatar for bumsfeld

Actually wx is a package rather than a file. With a package you should have a folder called wx and within it a file called __init__.py that declares the package. The overall effect is the same. Using wx as the namespace is the more modern convention. This way you are …

Member Avatar for wally_lawless
0
279
Member Avatar for G-Do
Member Avatar for isblevins

Create a website than can run an interpreter. I send, paste or type a short program code into the site's entry field and the site returns the result. The language I like to see is of course Python.

Member Avatar for jwenting
0
177
Member Avatar for a1eio

Okay, I got it, you mean explorer the filemanager, not explorer the internet browser. I never knew about eject for flash drives. I always used the "Safely Remove Hardware" icon in lower right corner of Windows, thanks for the tip! In my prehistoric days of programming I wrote a little …

Member Avatar for vegaseat
0
345
Member Avatar for wally_lawless

Welcome Walter to our tiny corner of the Python world! We do cater more to the apprentice in Python. As you learn this exciting language and have questions or make interesting discoveries, let us know! We do try to be friendly, inspiring and helpful. I just posted a wxPython example …

Member Avatar for vegaseat
0
132
Member Avatar for bumsfeld

Part 1 of the tutorial deals only with the header, wait till part 2 comes up! "Work real hard while you wait and good things will come to you!"

Member Avatar for vegaseat
0
162
Member Avatar for vegaseat

[B]Intro[/B] In part 1 we learned mostly about the header of the JPEG file. In this part we get to display the image and also extract and show any embedded comments. [B]wxPython[/B] To display the image we use wxPython. The raw JPEG image information is first pushed into a data …

0
120
Member Avatar for plazmo

Google for IronPython. I think they have gotten support from Microsoft, its meant to be the .NET version of Python.

Member Avatar for plazmo
0
193
Member Avatar for TheSkunkMan

To quit your game try something like ... [code]pygame.quit() [/code] This will clean things up before quitting. I know sys.exit() works, but you have to import sys. On your second problem I can only guess. You may need to update your screen with a ... [code]pygame.display.flip() [/code]

Member Avatar for vegaseat
0
177
Member Avatar for shanenin

You know this is a wonderful project. I remember when my son was about four, I wrote a hangman game where he had to guess rather simple words. He just loved that game. By the time he got to school, he was way ahead in spelling. Here is one idea, …

Member Avatar for bumsfeld
0
274

The End.