- Strength to Increase Rep
- +7
- Strength to Decrease Rep
- -1
- Upvotes Received
- 11
- Posts with Upvotes
- 7
- Upvoting Members
- 6
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 2
74 Posted Topics
Hey, Just a simple question really, i was looking through the documentation for python and i couldn't find anything that did basic cd drive things, like ejecting it and stuff. The one module i did find 'cd' was only compatible on IRIX systems. After failing miserably on google i was … | |
Re: I program for a hobby, not a job (yet) so i have a severe hunger for ideas, this thread is great and i would like to contribute, Here are some ideas that might give someone in my situation something to do: This is an extract from a song by pink … | |
Re: I personally always use the root.destroy() method, it seems to work best and I've never had any problems with it. | |
Re: what do you mean when you ask how to make the program show the paths to the selected folder and file. Do you want to show the file's contents, show an explorer window of the file's location or some sort of tree view of the file? | |
Re: [url]http://bembry.org/technology/python/index.php[/url] Has a whole quick tutorial and it has notes on all the main topics it covers, so you can read it, or use it as a reference, i found the Tkinter section wickedly useful as a starter into gui stuff, it also has some exercises. | |
Re: try GUI2exe, it's a gui wrapper for py2exe. [url]http://xoomer.alice.it/infinity77/main/GUI2Exe.html[/url] | |
Re: Yea but Micko has a point. it does suck when you want to take a simple short and sweet program you made with python to school or an internet cafe or any other place where you are not allowed to install stuff, i mean py2exe is good but whenever i … | |
Re: I'm not sure if I'm reading your question correctly, but if you want to open a file that's in the SAME place as your .py script that opens the file, you don't need to set any form of path name. You just type in the name of the file on … | |
Hi, all you daniwebber's!!! Simple (ish) question, AI seems to be a really cool subject, the one problem for me is that i havn't a clue at all what it is and how it works (more to the point, how i could learn to implement it) So i'm just wondering, … | |
Hi, I was wondering how someone would go about making a scrolling ticker or marquee using Tkinter in such a way that allows you to easily add on text and remove.. kinda like a news scroller on the bottom of the tv? thanks all a1eio | |
Re: school rules concerning computers suck. I have never met a schoo technician who is GOOD at his/her job, They always impose ridiculous restrictions for example at my school you can't even check the time on the windows startbar?? wtf?? In my opinion it provokes students to "mess" with the system … | |
For more information on threading read this [B]excellent[/B] 4 page tutorial: [URL="http://www.devshed.com/c/a/Python/Basic-Threading-in-Python/"]http://www.devshed.com/c/a/Python/Basic-Threading-in-Python/[/URL] | |
Re: don't hijack eggowaffles thread ramakrishnakota, if you need help and it's not related to this guy start a new thread | |
i've made a little animation using python and the pygame module, I'm just wondering if it's possible to turn that into a screensaver? is there a format i have to save it to? If anyone knows i would be grateful for the solution thanks, a1eio | |
Re: [code=python] encode = lambda txt: ".".join([str(ord(letter)-96) for letter in txt if ord(letter) in range(97,123)]) decode = lambda txt: "".join([chr(int(char)+96) for char in txt.split(".") if int(char) in range(1, 27)]) [/code] Output >>> [code] >>> encode('this is a message!!!') # anything not lowercase a-z gets silently ignored '20.8.9.19.9.19.1.13.5.19.19.1.7.5' >>> decode('20.8.9.19.9.19.1.13.5.19.19.1.7.5') 'thisisamessage' # … | |
Re: Google have this thing called the Google App Engine. [quote] Google App Engine lets you run your web applications on Google's infrastructure. ... Google App Engine applications are implemented using the Python programming language. The runtime environment includes the full Python language and most of the Python standard library. [/quote] … | |
Re: when you create a socket, you need to bind it with a port, address so other sockets have something to connect to. [code=python] sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind((address, port)) [/code] | |
Re: Hmm.. Well strangely enough it works on my machine (XP) From idle and from cmd. Not sure what the problem is, but if you need to get the address of a messege sender then just do that in the thread (if it's sockets it will be safe) | |
Re: python has a keyword function [icode]in[/icode] that would be useful in your example. [code=python] if password in pass_list1: # do something [/code] | |
Re: can you post the traceback? and what module's are you using? | |
Re: there must be something else going on. When you make a copy of a list [icode]list2 = list1[:][/icode] it fills list2 with list1's values, but when you change either list1 or list2, the change isn't mirrored so list1 would stay the same if list2 was changed. Are you sure your … | |
Re: You should definitely use tkinters .after() function, it enters a local event loop which means it doesn't block your program. [code=python] def blink(self): if not self.stop: # check self.stop is false before proceeding print 'looping',self.stop self.label.configure(bg=choice(COLORS)) self.label.update_idletasks() self.after(100, self.blink) # after 100 ms, call function self.blink [/code] choice is a … | |
Re: Well you could just use a Thread object to do the counting for you and then in your main program everytime the user enters a key, you just call a function of the Thread object counting that returns it's current value. The example below might help. [code=python] # counterTest.py, a1eio … | |
Re: [code=python] n = float(2) m = float(3) print n/m [/code] Or [code] n = 2.0 m = 3.0 print n/m [/code] Hope that helps. | |
Re: well as far as i can see, whatever resides within [icode]self[filename][/icode] is clearly not a valid filepath. There was a sort of hint to what it might contain in the second error. [quote] [IOError] of [Errno 36] File name too long: 'ProjCat,RefNum,ProjTitle,MemberName,ProjDeadline,ProjGrade\nI,0001,"Medical Research in XXX Field,2007","Gary,Susan",20.05.07,80\nR,0023,Grid Computing in today era,"Henry … | |
Re: [code=python] def function(*args): print type(args) print args function('arg1', 'arg2', 'arg3') [/code] output [code] <type 'tuple'> ('arg1', 'arg2', 'arg3') [/code] If you need a list: [icode]args = list(args)[/icode] | |
Re: hmm.. what module is this 'call' function from? because it's not a builtin / keyword function | |
Re: [code=python] >>> string = "A simple example string." >>> if 'example' in string: print 'the word '%s' is in: "%s"' % ('example', string) the word 'example' is in: "A simple example string." >>> [/code] | |
Re: Well if your running your tkinter gui by calling: root.mainloop() or something similiar then you should change that to: [code=python] while 1: root.update() #repeat code here [/code] You do everything as normal but then when you get to the displaying part, you enter a loop which updates the gui and … | |
Re: [code=python] >>> exec("print 2") 2 >>> exec("print 2+2") 4 >>> exec("vars = (var1, var2, var3, var4) = 'a', (1,'2',3.0), 44, 0.7\nfor v in vars:\n print v, '=', type(v)") a = <type 'str'> (1, '2', 3.0) = <type 'tuple'> 44 = <type 'int'> 0.7 = <type 'float'> [/code] | |
Re: [code=python] playerScores = {"player1":0, "player2":0} ... ... if player1 won: playerScores["player1"] += 1 elif player2 won: playerScores["player2"] += 1 for player in playerScores.keys(): if playerScores[player] >= 5: print player, "won" restart game [/code] First line creates a dictionary, pseudo if statements show how you can add 1 onto each players … | |
Hi all! Just wondering if it was possible to be able to create a Tkinter window that can handle files being 'dropped' on it. What i want is to be able to drag a file from an explorer window to a widget on my program (probably an Entry widget) and … | |
Re: Personally i would use threading (thats the short answer) As far as how to go about it, you've got a big project on your hands. | |
Re: it's never too late to learn python :) awesome language, you'll pick it up quick and it beats VB (in my opinion) | |
Re: did you define gold? gold = gold + 5 if 'gold' is not defined before that statement then it doesn't know what to add 5 onto. | |
Re: not sure what you mean exactly, but why are you creating a temporary instance of Kangaroo in the put in pouch function? I thought you meant you wanted roo's pouch added into kanga's pouch? if thats the case then your code is fine, except you need to define pouch in … | |
Hi, I'm wondering how your supposed to find out a widget's width in tkinter.. Little example code to explain (doesnt do anything at all) [code=python] class CustomWidget(Tkinter.Frame): def __init__(self, master, **kw): apply(Tkinter.Frame.__init__, (self, master), kw) self.masterWidth = # ???? Totally stuck, tried obvious things like master.width class MainWindow(Tkinter.Toplevel): def __init__(self, … | |
Re: not sure what you mean by adding fonts, but when you create a font object, you can specify a pygame font, or a path to a custom font of your choice. [code=python] font1 = pygame.font.Font("C:\customfont.ttf", 12) [/code] | |
Re: Hi, download numpy here: [url]http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103[/url] download matplotlib here: [url]http://sourceforge.net/project/showfiles.php?group_id=80706&package_id=82474[/url] install both and you should be set to go, drawing a simple graph and displaying it is as simple as: [code=python] >>> from pylab import * >>> plot([1,2,3,4]) [<matplotlib.lines.Line2D instance at 0x01A34BC0>] >>> show() [/code] Obviously you can do a lot … | |
Re: lol pygame is fun, give it a go.. hardly industry standard top notch gaming, but you can make some very interesting games :) | |
Hi, I'm a bit stuck on getting 1 function that's not inside any class or function, accessible or callable to everyother part of the program, from within classes and the Main function.. i've tried to make it global but i'm not sure on how to make it work and it … | |
Re: Hi, i might be missing something, but from what i understand your program, gets an int from the user, validates it, then it enters a for loop and checks each number (p) of the loops range, to see if its prime and if the user's number minus p, is prime. … | |
Re: Hi, there's a few methods, someone asked a similiar question a while back on this forum: [url]http://www.daniweb.com/forums/thread47882.html[/url] This is a snippet showing how to do it with wxPython (a GUI library like Tkinter but more advanced) [url]http://www.daniweb.com/code/snippet435.html[/url] and you could also do it using Tkinter and just display each still … | |
Hi, I'm trying to create 6 buttons in a for loop using tkinter, each button's command points at the same function, but passes a variable (the loop counter.. in this case i) now for some reason.. when i run it, and click on each button, the function is supposed to … | |
Hi all, Just wondering if there is a way to see if a window has been destroyed or not. eg: [code] root = Tk() bla ... bla ... if root has been destroyed: do something... [/code] thanks in advance a1eio | |
Hello, I was wondering whether it was possible to embed something made with pygame, like some sort of animated display or bouncing ball whatever, into a Tkinter made window, with tkinter buttons/frames etc... Anybody heard of this or know of if it can be done? Thanks a1eio | |
Re: yea, ditch the printing and append it to a list and it'll be almost instant. :) | |
Hi, I'm trying to pin an image to a button, using the 'image' option. I've looked about on the net and it seems the best way to do it is to create the image in a PhotoImage object. I've done this and then stuck it onto the button but for … | |
Hi, I want to create a little Frame class that has two labels built in, the code snippet below is the class. [CODE=python] class DescriptionFrame(Frame): def __init__(self, master, title="", text=""): Frame.__init__(master) self.title = title self.text = text self.titleLabel = Label(self, text=self.title, font=("Times", 12, "underline"), fg="darkred") self.titleLabel.grid(row=0, column=0, sticky=W) self.mainLabel = … | |
|
The End.