407 Posted Topics

Member Avatar for danae.gordon9

Python's double-ended queue called deque in module collections has a method rotate() that is ideal for that sort of thing.

Member Avatar for vegaseat
0
262
Member Avatar for vuze
Member Avatar for aanchal_1

If pygame and tkinter have event loops, then you have to use threading to separate them.

Member Avatar for ZZucker
0
239
Member Avatar for Gaven
Member Avatar for drayford

This might give you some important hints about GUI programming: ''' tk_Entry_input101.py explore multiple tkinter Entry() for inputs note: Python2 uses Tkinter Python3 uses tkinter ''' # Python3 import tkinter as tk def name_action(event): person = enter1.get().capitalize() sf = "Hello {}. How are you today?".format(person) result['text'] = sf # now …

Member Avatar for ZZucker
0
325
Member Avatar for nyfan68

You might have to use the setText() method like this: # blank out old text first correctMessage.setText(" ") correctMessage.draw(self.win) correctMessage.setText("Correct!") correctMessage.draw(self.win)

Member Avatar for ZZucker
0
298
Member Avatar for alyons

Here is a typical example: ''' tk_BGImage1.py use a Tkinter label as a panel/frame with a background image (note that Tkinter without PIL reads only GIF and PGM/PPM images) modified from a vegaseat example ''' try: # for Python2 import Tkinter as tk except ImportError: # for Python3 import tkinter …

Member Avatar for ZZucker
0
9K
Member Avatar for j.heller

This might help: # use opacity alpha values from 0.0 to 1.0 # opacity/tranparency applies to image and root frame root.wm_attributes('-alpha', 0.7)

Member Avatar for ZZucker
0
218
Member Avatar for j.heller

destroy() is used to destroy a particular window in a multiwindow program you have to give all the Tk windows a unique name

Member Avatar for woooee
0
5K
Member Avatar for veledrom

A RAD GUI Building IDE for Python using wxPython: http://sourceforge.net/projects/boa-constructor/ See also: http://www.daniweb.com/software-development/python/threads/20774/starting-python/6#post400296 If you use Python3 you can go with the Eric5 IDE. That program is free and uses the powerful PyQT GUI toolkit. That in turn comes with a designer (form builder). Google for Eric5 PyQT4 free from: …

Member Avatar for Tcll
0
517
Member Avatar for azareth
Member Avatar for kxjakkk

Here is a hint ... ''' filename_list_given_dir1.py use module glob to list all the filenames of .jpg files or any extension(s) you specify in a given directory ''' import glob import os # all files (split off file names) in a given directory directory = "C:/Temp/*.jpg" # this would give …

Member Avatar for kxjakkk
0
644
Member Avatar for oanahmed
Member Avatar for oanahmed
0
346
Member Avatar for debasisdas

[QUOTE=efmesch;504817]I won't say it's the only definition, but vitally important aspects of the concept are: Real love is long-term mutual commitment and includes and infinite amount of the ability to forgive.[/QUOTE]"Love is infinite forgiving" Sounds real nice! You must be a person of much experience efmesch.

Member Avatar for James_28
8
17K
Member Avatar for rbyrd

Here you go: ''' wx_colourdb_show1.py show the colours in wxPython's wx.lib.colourdb the database has 630 named colors use wx.lib.scrolledpanel.ScrolledPanel and wx.GridSizer to show the colours and their names Python 2.7.5 ''' import wx import wx.lib.scrolledpanel # note the goofy english spelling import wx.lib.colourdb class MyScrolledPanel(wx.lib.scrolledpanel.ScrolledPanel): def __init__(self, parent): # make …

Member Avatar for rbyrd
0
696
Member Avatar for rmsh92

Should be: if (temperature > 35) { // do something } else if (temperature >= 27) { // do something else } else { // do something else }

Member Avatar for 2384443
0
207
Member Avatar for ddanbe

All those people trying to cover up their wrinkles. I would start sellling cosmetics!

Member Avatar for Ancient Dragon
2
2K
Member Avatar for jursnamo
Member Avatar for Banfa
0
158
Member Avatar for davidw87

There ar three basic ways to load and display an image with Tkinter: 1) from an image file you have, GIF is native any other file format needs PIL see tk example in: http://www.daniweb.com/software-development/python/threads/191210/python-gui-programming#post866067 2) from a base64 encoded image string pick an example from: http://www.daniweb.com/software-development/python/code/440446/python2python3-base64-encoded-image 3) from a web …

Member Avatar for vegaseat
0
475
Member Avatar for alone88

The news just reported that the Porsche these dummkopfs were driving went over 100 miles/hour in a residential area.

Member Avatar for ZZucker
0
439
Member Avatar for HiHe

You have to consider that a good chunk of the $634 million contract price goes back to the polititians that made it possible that you got the contract. Not sure what the going cut in Washington is these days.

Member Avatar for mike_2000_17
1
858
Member Avatar for Yarynka
Member Avatar for Yarynka
0
108
Member Avatar for robert99x
Member Avatar for robert99x
0
293
Member Avatar for HiHe

I take my iPad with me on the train, but don't commute during typical rush hour.

Member Avatar for pixelsoul
2
181
Member Avatar for glao

This should work: def is_string_in_list(mystring, mylist): for c in mystring: if c not in mylist: return False return True # short test mylist = ['a', 'b', 'c'] mystring = 'acb' print(is_string_in_list(mystring, mylist)) # True mystring = 'afc' print(is_string_in_list(mystring, mylist)) # False

Member Avatar for glao
0
505
Member Avatar for glao

The first line in your function is `count=0` so that is what will happen each time you call the function. If you use it as an argument, then it is only used when the function is defined, as a default value. A temporary test print is your friend!

Member Avatar for glao
0
193
Member Avatar for theUserMan

Study this in detail: http://www.pygame.org/docs/tut/camera/CameraIntro.html I think it supports only certain cameras.

Member Avatar for ZZucker
0
478
Member Avatar for Waseemaburakia

Looks like your teacher wants a more complex input in function main() like this: # endless loop with exit condition while True: print("Enter tution rate, current year, target year") print("in the form nnnnn.nn xxxx yyyy") data = raw_input("? ") current, thisYear, targetYear = data.split() current = float(current) thisYear = int(thisYear) …

Member Avatar for ZZucker
0
281
Member Avatar for Mistyz

This basic class example should send you on your Python way: class Rectangle: # class constructor # supply it with initial length and width values # self refers to the instance def __init__(self, length, width): self.width = width self.length = length def setLength(self, length): self.length = length def show(self): print("rectangle …

Member Avatar for ZZucker
0
544
Member Avatar for nitin1

Another video series: http://www.youtube.com/user/ryanmshea or: http://www.youtube.com/playlist?list=PLEA1FEF17E1E5C0DA

Member Avatar for nitin1
0
417
Member Avatar for aVar++

Syria was a French colony for 20 years and the occupation was brutal. Strange that these are the only folks who want to join us in bombing the place.

Member Avatar for HiHe
3
2K
Member Avatar for MrNoobieCoder

Since you are already using Python3, This would simplify it somewhat: def get_int(prompt="Enter an integer: "): """this function will loop until an integer is entered""" while True: try: # return breaks out of the endless while loop return int(input(prompt)) except ValueError: print("Try again, value entered was not an integer.") width …

Member Avatar for MrNoobieCoder
0
276
Member Avatar for nitin1
Member Avatar for jwenting
-3
1K
Member Avatar for Joseph Vann

More modern: ''' tk_button_toggle6.py using itertools.cycle() to create a Tkinter toggle button ''' import itertools try: # Python2 import Tkinter as tk except ImportError: # Python3 import tkinter as tk def toggle(icycle=itertools.cycle([False, True])): state = next(icycle) t_btn['text'] = str(state) root = tk.Tk() t_btn = tk.Button(text="True", width=12, command=toggle) t_btn.pack(pady=5) root.mainloop()

Member Avatar for ZZucker
0
399
Member Avatar for coroneshotel2

The Washington Post reports that the NSA has done many thousands of illegal snooping without the approval of the rubberstamp courts. Is the system out of control? By the time people are scared to say anything against their rulers, it's too late!

Member Avatar for jwenting
0
111
Member Avatar for Trap910

There are a lot more Java jobs since it takes more person hours to develop programs with Java. As I understand it, most apps are written with Java. However, there is a lot of garbage out there.

Member Avatar for vegaseat
0
283
Member Avatar for vegaseat
Member Avatar for nitin1
Member Avatar for nitin1
-1
509
Member Avatar for happygeek
Member Avatar for ChrisHunter
0
192
Member Avatar for Tcll

To me Python has always been the quick tool to develop ideas. A bloated cumbersome IDE does not help.

Member Avatar for Tcll
0
657
Member Avatar for lewashby
Member Avatar for nytman

If the user enters an integer, your program should be smart enough to use it as a float. I also understood you didn't want to use "try except" error handling. Quoting: > ... but how it will be done without using "try and exception"

Member Avatar for nytman
0
19K
Member Avatar for Liam_1
Member Avatar for TrustyTony
0
707
Member Avatar for debasishgang7

See: http://stackoverflow.com/questions/17079934/opening-files-with-pydbg-while-application-is-running

Member Avatar for debasishgang7
0
258
Member Avatar for G_S
Member Avatar for Jacklittle01

Another option is to use Tkinter's simple dialogs for user input, and to some extent output too: # use Tkinter's simple dialogs (pop-up) to ask for input # minvalue and maxvalue are optional try: # for Python2 import Tkinter as tk import tkSimpleDialog as tksd except ImportError: # for Python3 …

Member Avatar for ZZucker
0
159
Member Avatar for ytbyun
Member Avatar for vegaseat
Member Avatar for ZZucker
3
307
Member Avatar for vegaseat

Thanks Henri, module pyttsx is somewhat complicated to install, but works well. Doesn't seem to work with Python3?

Member Avatar for ZZucker
1
2K
Member Avatar for otengkwaku
Member Avatar for snippsat
0
296

The End.