92 Posted Topics
Hi, so I'm currently porting one of my applications (it's a media player) from Tkinter to wxPython and I am having some trouble as this is the first wx application I have attempted. I am trying to create something similar to [URL="http://i189.photobucket.com/albums/z266/Capn_Soul/DesiredLook.jpg"]this[/URL]. However, I can't figure out the wxPython code … | |
Hi, so in essence I have two little scripts: a server side script and a client side script. My client script sends a request to the server, and the server sends a string to the client. Once I get the string back into the client, I set it to the … | |
Re: If you're just doing this for yourself and are not too concerned about efficiency, this should suffice: [code=python]from socket import * if __name__ == '__main__': target = "localhost" targetIP = gethostbyname(target) print 'Starting scan on host ', targetIP #scan reserved ports for i in range(20, 1025): s = socket(AF_INET, SOCK_STREAM) … | |
Hi, I'm mostly a Python programmer but I now want to move to more web-based applications. What languages would you guys recommend for creating online games/applications? I already have a few Java books as I have been itching to learn it; would it be a good choice for web development? … | |
Hi, so as an excuse to learn Java (I currently only know Python), I would like to write a simple 2D web-based game. How would you recommend me doing this? Should I write the entire game from the ground up? Should I use a game engine? If you would like … | |
Okay, being a Linux guy, I absolutely hate it when applications are not cross-platform (Windows only). So, I decided to write myself a cross-platform media player. I have spent quite the bit of time making it look great on Linux, but I am unable to do the same on Windows … | |
Hello, I'm writing a music player and I'm having trouble with one of the most important concepts of it: remembering songs you add to your "Library". The main draw of my music play is being quick and efficient at everything, and keeping that in mind, what would be the best … | |
Hi, I'm trying to add an icon to my Tkinter GUI window and have had no luck. After some searching, I came up with the same piece of code which does not work. Here is a snippet of my code: [code=python]from Tkinter import * root = Tk() root.minsize(290, 700) root.title("My … | |
I'm trying to bind a Tkinter widget to a method in another file. I'm not quite sure how to do this, but let me show you what I have so far. [code=python]#!/usr/bin/python # File1.py from Tkinter import * import File2 class MyFile: def __init__(self): master = Tk() obj = File2.DoStuff(master) … | |
Okay, well I have to say I am completely stumped where to go from here. I am writing a media player and I am currently working on song indexing. I have figured out how to extract the song name and its complete path using os.walk(); however, I have no idea … | |
So...I have just begun to whet my appetite for Java today, and I have already run into a stumbling block. When I put my code in a .java file and compile it (via javac), I receive no errors. However, when I actually run my script, I receive quite the nasty … | |
Okay, well I've been looking for at least an hour now for some straight-forward python-xlib documentation, and I have been unable to find any. Luckily...I have quite the easy problem. If somebody would be able to help me create a simple script that would say "Hello" every time the left … | |
Okay, well I'm having trouble getting a variable from one place to the other. I have two scripts: for now, let's call them MainScript.py and ChildScript.py. [code=python]#!/usr/bin/python # MainScript.py import ChildScript from Tkinter import * class GetVariable: def __init__(self): master = Tk() master.withdraw() ChildScript.VariableDialog(master) # From right here, I would … | |
Re: Okay, when you are prompted, type nothing, and just press enter, the variable is set to the following: "" As for the reason why your code doesn't work: The line "d = (a and b and c)" is actually doing the following:[code=python]d = a d = b d = c[/code] … | |
Okay, so I am writing a media player and I would like to be able to control the entire thing without the use of a GUI. So...are there any libraries or anything that would allow me to collect keystrokes on any OS (not just Windows)? Thanks in advance. | |
Re: Try this: [code=python] import random number=random.randint(1,100) victory = False for x in range(0,7): guess=input("please enter your guess: ") if guess<number: print "too low" if guess>number: print"too high" if guess == number: print "Correct!" victory = True if victory == False: #If they didn't guess the number by the end... print … | |
So, I have a script that needs to "clean up" when it is exited: it needs to clear a special logging file and other small things that affect the next startup of the script. The script has a GUI written in Tkinter, if that is relevant at all. Is there … | |
Okay, so I'm having a little trouble. Let's say I run "scriptA.py" and it has a GUI (Tkinter) and it is running in its mainloop. I want to create a "scriptB.py" that can end "scriptA.py"; would there be a way to do this regardless of the OS it is on … | |
Re: You have two options. 1. Save the file as a .pyc instead of a .py. 2. Try "root.withdraw()". (replace root with whatever you named your root widget) Or you could compile it with py2exe if you want to get fancy and Windows only. (if you choose this option, let me … | |
Ok, well I am JUST beginning to learn Java, and I have run into a little stumbling block. I am attempting to write a little applet, but it doesn't seem to want to run. My Java code: [code=java] import java.awt.*; import java.applet.*; public class TestApplet extends Applet { public void … | |
Hi, I'm looking for a little help with the function "getattr". Here's my code: [code=python]class MyClass: def __init__(self): trycmd = getattr(self, "cmd_testing") try: trycmd() except: print "Fail." def cmd_testing(self): print "Victory!" obj = MyClass()[/code] So, when I run this code, I get the output "Fail.". I'm not sure what I'm … | |
So, I have a rather simple question today. I'll try to explain it by using an example. Let's say there is a line of HTML in the page "www.mywebsite.com/py" that says "<tr colData0='Friday'>". However, this line of code can change to be "Sunday", "Tuesday", etc. What would be the easiest … | |
Hi, I have written a simple chat server and a client that can connect to it. To make it more secure, I would like to add SSL to the connection process. How would I go about doing this? Thanks in advance. | |
Ok, I am writing a client for the "instant messaging" server I just wrote. The client is in all Python, and the GUI is made with Tkinter. Anyways, my first question is this: is there a way to make a scrollbar widget automatically scroll to the bottom? Second, in a … | |
Hi, so in order to make my problem more clear, I shall just make a simple example of what I am trying to do. I will start with a little code: [code=python]from Tkinter import * master = Tk() msgbox = Text(master) msgbox.pack() mytext = raw_input("> ") msgbox.insert(END, mytext) master.mainloop()[/code] Now, … | |
Re: [QUOTE][/QUOTE] Also, if you did not want to use threading/multiprocessing, you could use the "after" method. Example: [code=python]def dothis(): #Do something master.after(2000,dothis) master = Tk() myapp.after(2000,dothis) master.mainloop() [/code] Arguments: The first argument is the time in milliseconds, the second is the function to run after the time set in the … | |
Re: [quote][code=python]print 'Hello ' + name[/code][/quote] Try this: [code=python]print "Hello,", name[/code] The why: If you use the code: "string1"+"string2" You get the following: string1string2 However, if you use this: "string1","string2" You get: "string1 string2" (notice the space) | |
Ok, I really hated to resort to threading, but it seems like I have no other choice. I am writing a client script for the "instant message" server I just finished writing. Sadly, I am having a slight problem with threading. What I would like to do is have two … | |
Hi, so I am trying to write a simple chat server in Python. If I just run the server, it runs fine. Yet, when I try to connect to the server from a different terminal via a "telnet localhost (port)", the server gives me an error: [quote] error: uncaptured python … | |
Hi, I am writing a script that aims to help a person keep a list of characters while reading a book. In doing this, I am writing to a file and checking it constantly, except I ran into a problem. Say I executed a code block such as the following: … | |
This is my first PHP script, so please excuse my clumsiness. I have a HTML page which consists of a form and a PHP page which deals with the variables that are outputted. The HTML page functions as a small box that asks to input an email account/password, and the … | |
So, I always thought that it was possible to return dictionaries in Python. I was wanting to do this because I would prefer not to use globals. However, I am having trouble with returning my dictionary. Code: [code=python] #!/usr/bin/python # 6/9/09 def loadWords(): pathstart = "/home/foo/Documents/PyScripts/Vocab/Lists/" print "What is the … | |
So, I have this script that I am using to study some Biology vocab words for my final tomorrow. All I did was put the list of words/definitions in my existing script, and everything seems to go wrong. I have a total of 50 definitions, yet it says there are … | |
For my script, I am trying to open a text file and print out the information in the console window. However, I am having trouble finding the right way to load it. To start, I need to figure out how to load something in the same directory as the script, … | |
So, I had a quick question about having multiple arguments being read into a bash script. In the following script, if I type "./myscript -h", it returns "Hippo.". However, if I type "./myscript -h -k", the script returns only "Hippo." I would like to know how to have the script … | |
Hi, so I just have a question that I at least think will be pretty easy. So, I am making a script that basically gives you a "vocabulary test". There is just one feature I would like to implement that I need help with. I would like to make it … | |
Hello, if you have seen any of my other posts you will know I am working on a script to make a "vocabulary test". I currently having it functioning nearly perfectly, except I get an error if I enter the wrong word. Code: [code=python]def vocabtest(): for r in words.values(): count … | |
For reference, I am using Python 3.0. So, I have a small script I am working on trying to improve. I am now trying to create it with only dictionaries and loops. My problem is that I keep getting a Key Error at one of my lines. The line with … | |
Hi, I have been learning Python and have a quick dictionary question. I am trying to make a "vocabulary test" to help myself study, and am trying to do it with a dictionary. So far I have this: [code=python]testwords = {"uno":"one","dos":"two","tres":"three","cuatro":"four",\ "cinco":"five"} def vocabtest(): for value in testwords: print "What … | |
First off, I know that to set an indexed variable, say, mylist[3] = "Hello". I also know that you wouldn't be able to set mylist[3] if you didn't first state: [code = python]mylist = ["Whatever", "Whatever", "Whatever", "Whatever"][/code] But, if you had a variable with an extremely large index, it … | |
Well, I have recently created a "translation" program. It basically asks what languages you would like to translate between, then goes to the appropriate page on a translation website. I have integrated an option to keep using a language, rather than having to start at the main menu again. Except, … | |
I started programming in Python as a hobby a few weeks ago, and I have run into a little problem. I am currently making a script to give me a sort of Vocabulary Test. It is kind of hard to explain so I will just show you the code. [code=python] … |
The End.