345 Posted Topics
Re: you want to open the text file in your python program? [url]http://lmgtfy.com/?q=Python+File+IO[/url] | |
Re: I recommend that you place print statements in various places in your code, so that you can find the actual place of the issue. It may not be the function that is not working, it could be one of your if() statements or whatever. Work through your code, so that … | |
Let's say I have this: [CODE] class main: def add(self): print '1 + 2 = 3' [/CODE] I then want to be able to call the add function again from within itself. Like this (BUT THIS DOESNT WORK!!!) [CODE] class main: def add(self): print '1 + 2 = 3' self.add() … | |
Re: No offence, but you are being slightly stupid :D There should be no difference in window size in either of your attemps. This is because you are calling[CODE]root = Tk()[/CODE]which is what makes the window. You can use stuff like this: [CODE]root = Tk() root.title('hello') root.minsize(100, 100) root.maxsize(400, 400) root.geometry("231x326") … | |
Re: No I don't think so...only GNU/Linux :( Still, Windows is win :D | |
Re: Are you using 64-bit Python? If so, this is likely to be the issue. Unfortunately, you will need to uninstall all the python modules you have and reinstall them on a 32-bit version of Python. Some modules such as Pygame and PyQt4 do not yet have support for 64-bit Python. … | |
Re: It's printing you lose because you are trying to use the module 'random' as a variable. Therefore, no statements in your loop for win checking are excepted, apart from, of course, the else statement, which prints 'You lose'. You need to make a variable for the computers' choice. So this … | |
Re: What are you trying to do? What do you need to find out? What does it do? Why should we help you? Why aren't you using code tags? What the hell are you even talking about... | |
Hi again. I want to have a file for one of my python programs, that looks something like this: [CODE]<WINDOW> #Window size 640 480 <WINDOW TITLE> App Platform Test <ICON> icon.png[/CODE] I have a function that reads each line of, and uses the data to make a window. What happens … | |
Re: Are you allowed to use other modules? If so use pygame. Look at the documentation at pygame.org under key. I'm pretty sure you can set modifier keys. | |
Hi guys! I am in the process of making a game...similar to this one: [url]http://www.miniclip.com/games/nfl-lateral-collateral/en/[/url] I am using the following code to detect key presses: [CODE] pygame.event.pump() key = pygame.key.get_pressed() if key[pygame.K_LEFT]: ... [/CODE] How can I detect if a key is released? I have seen this done with using … | |
![]() | Re: Well I'm actually doing some tutorials on Youtube ATM, covering lots of stuff in Tkinter. I did a vid on cascade menus but I didn't cover parent to child. Anyway here is a link to my vids: [url]http://www.youtube.com/pyProgrammer96[/url] |
Re: Hi. Note for next time: GIVE MORE INFO! You were having an error with the top.config() command. This is backed up by the fact that I took the not working code and changed it to this: [CODE] from Tkinter import * root = Tk() menubar = Menu(root) frame = Frame() … | |
| |
Re: You have two problems: 1. Your code is all over the place 2. Your binding everything to the same window. 1. With your class, you should call root = Tk() inside the __init__ function, this also means that root.mainloop() should go at the end of the __init__ function. Also, I … | |
Re: I use Netbeans. Its great for organising your projects, and it shows you errors as you type. It can do pretty much any language as well, if you download the plugins (python is a plugin!). Just download the base IDE and get the python plugin. | |
Re: For a menu, just make a new function. Have it print out the choices on screen, including a number, and then the option is chosen by inputing a number. You could use the raw_input() function, but this is rather crude, as it throws errors, if it recieves a value that … | |
Re: I have Windows 64-bit on my PC. It's quick, though mostly because my computer's hench. Anyhoo, I just think Win7 is sexy... | |
Re: oh BTW just got summin to add. I no ur linux and im win7 64-bit but hey... i use: [CODE] import os strng = os.system('dir') #using dir as example - a cmd function print string #show us os.system('pause') #give us time to reeeeeaaaaadddddd. [/CODE] i no ive only done it … | |
Hi all. :) I'm having trouble with pygame, images and transparency. Lets say I have an image...a circle to keep it simple (for example only). What I want is to be able to draw the image, but with only the circle showing (ie. not a white box around it). Oh … | |
Hi all. :) I'm having trouble with pygame, images and transparency. Lets say I have an image...a circle to keep it simple (for example only). What I want is to be able to draw the image, but with only the circle showing (ie. not a white box around it). Oh … | |
Re: well have you started? what code have you got already? what are you stuck on? we wont help you if you get the answers 'no' and 'none' to the first questions. Sorry to be of no help, but it's a rule. | |
Re: Also, you may need header guards. Check out this thread (started by me - when I was more of a noob than I am now...). [url]http://www.daniweb.com/forums/thread238216.html[/url] Hope it helps... Mark | |
Re: I don't know if this is what your looking for - i just did a quick google! [url]http://www.devshed.com/c/a/Python/Database-Programming-in-Python-Accessing-MySQL/[/url] | |
Re: Use Dev-C++ cos its best for installing new libs. | |
Re: If you want to print it out, then it's best to print out how many people got a certain amount of marks before starting the function again. Then you have no way of retrieving the data if you write over it. Also, you need: if finish == no: instead of … | |
Hi everyone! I would like to make an Air Hockey game in pygame. I was wondering if it was possible to have 'proper' bouncing (ie. the puck goes in a direction relative to the angle the paddle hit it in). I can easily write the rest of the code. Thank … | |
Hi all. Every now and again I get these Java update messages, which (if I choose to) in stall the latest JRE. In the C:\Program Files\Java folder, I have: One folder named: 'jre6' Several named: 'jre1.60_' and then a number (01, 02, etc.) I presume that the folders 'jre1.60_...' are … | |
Re: Have you started? If so, can we see your code so far? If not, well don't wait for a reply - start programming now and you might make it. No-one here will help you. It's a rule. [quote] The Queen of DaniWeb: 'We only give homework help to those who … | |
Hi all. I'm interested in Java ME, so I downloaded Netbeans with the JDK. Here is the story: 1.) I installed the wrong version of Java JDK 2.) I removed the JDK 3.) Accidentally removed JRE as well :( 4.) JDK data still on system 7.) Downloaded and 'installed' Netbeans … | |
Re: Also, I don't think many people would bother writing a program that does that - they would just learn to write it correctly in the first place. Soooooo obviosuly a homework... | |
Hi all. I'm using the following tutorials: [url]http://lighthouse3d.com/opengl/glut/[/url] (for GLUT) [url]http://www.3dcodingtutorial.com/[/url] (for GLM (3D models)) I'm using OpenGL with GLUT and GLM to make a 3D game. Seeing as I was a complete noob, my friend challenged me to make a game 'where you can shoot stuff'. Anyhoo, all was … | |
Re: and??? What's the problem... no one here's gonna write it for you...just help you... | |
Re: may we see your code, or would that be cheating? | |
| |
Re: What happens? Soz I don't have CodeBlocks + I'm on my DSi. Anyway, you could put: using namespace std; instead of putting: std::cout... all the time. Also, do you need to declare the two void functions at the top, as they have nothing in them, and you declare them later. | |
Re: well it would need to be over a network, unless you are relying on peoples sense of not looking at their friends card so they can own them. With networking, you need to send messages to the clients telling them what the other players have done, so it doesn't all … | |
Re: I recommend that you start with simple graphics. Head over to this site, and start on the allegro tutorials. [url]http://www.cppgameprogramming.com/cgi/nav.cgi?page=allegbasics[/url] :icon_idea: PS. Double click anywhere on the site to bring up a menu to go onto the next tutorial. | |
Now I must explain that I am a noob. I would like to write my own header file, and use the functions from it in a program. When I get Dev-C++ to compile, it says that it is an invalid function, and I need to put that before the main. … | |
Re: All you need is to have the data stored in variables that can then be written into a text file (saving) and then read from the text file (loading). Check out the tutorials at cplusplus.com. Then have a function that can be called by the user, that writes out a … | |
Hi. Firstly, I am a complete noob, and cannot understand complicated answers. OK. I'm making a noobish space game, called Galactic Armageddon. I'm just testing the variables right now (for getting hit by lasers, missiles, etc.). I'm compiling using Dev-C++ and the default compiler. The program is written using the … | |
Re: Thanks Tom. It worked for me too! I'm a complete noob, and I get loads of errors that I can't understand. |
The End.