4,305 Posted Topics

Member Avatar for wandie

To append seltext to existing text in the entry widget simply use: E1.insert(END, seltext)

Member Avatar for LouLouLou
0
166
Member Avatar for dcc

[quote=jbennet;369819]ours is like 94 - 99 pence per gallon (thats about $1.90ish)[/quote] Per gallon? My English relatives tell me it is more like US $7 ++ per gallon.

Member Avatar for jwenting
0
222
Member Avatar for StrikerX
Member Avatar for StrikerX
0
152
Member Avatar for 7even

To hide or show a wxPython widget you can use something like ... [code]button1.Hide() # make button invisible button1.Show() # show it again [/code]

Member Avatar for vegaseat
0
223
Member Avatar for Lapinbriac

When you run your Tkinter program, you are running a Windows GUI program and the eventloop of that program will intercept all keyboard and mouse events. Why can't you let the user enter the answers into a Text widget? It is very hard to mix console and windows programs.

Member Avatar for aot
0
189
Member Avatar for Lapinbriac

It would be simple to use the capture option that comes with many image viewers like XnView (nice and free). For another potential solution look at: [URL]http://www.daniweb.com/code/snippet705.html[/URL]

Member Avatar for vegaseat
0
164
Member Avatar for fredzik

I am not quite sure what you are trying to do, but your widget placements are off the map. It looks to me like you are trying to make a console type game with a GUI. In that case I would recommend to use the text widget and scroll that. …

Member Avatar for fredzik
0
2K
Member Avatar for vital101

This depends on which browser you are using. Netscape keeps the cookies in a text file, and IE in a directory as individual files. Take a look at: [URL]http://www.cookiecentral.com/faq/[/URL] For an example how to explore IE cookies see: [URL]http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/80443[/URL]

Member Avatar for vegaseat
0
89
Member Avatar for aot

Take a look at this Python code snippet: [URL]http://www.daniweb.com/code/snippet467.html[/URL]

Member Avatar for aot
0
99
Member Avatar for qwerty__123

If I understand this right you want something similar to this ... [code=python]# take a random hand of cards where each card is identified by # string 'rank suit' and sort by rank and suit def cards_str2tup(cards): """ convert each card 'rank suit' string to a (suit, rank) tuple where …

Member Avatar for bumsfeld
0
104
Member Avatar for Rashakil Fol

Ruby looks a lot like Python. The Python syntax, at least to me, looks cleaner. I do like the help file that comes with Ruby.

Member Avatar for Gazco
0
205
Member Avatar for nam5a
Member Avatar for chris99

You got to let us know a little more, what module are you using, pygame, tkinter, gtk, wx?

Member Avatar for chris99
0
145
Member Avatar for dwrick

My suggestion is to break this monster down to smaller parts and test each part before you assemble it all. Get familiar with GUI programming, classes, callbacks, functions and so on. At first glance there are a lot of mistakes. For instance this line: printrec= Button(a, text ="PRINT LIST",command=project.printfile(thelist1)) has …

Member Avatar for vegaseat
0
1K
Member Avatar for olufunkky

Please use the [B][noparse][code=python][/noparse][/B] and [B][noparse][/code][/noparse][/B] tag pair to enclose your python code. Good grief, you are almost there! You have ... [code=python]mylist = [2, 4, 6, 8, 10, 12, 14, 16, 18, 10] sum = 0 for num in mylist: sum = sum + num print "The sum is", …

Member Avatar for olufunkky
0
290
Member Avatar for fredzik

Your program may be a good candidate for place(), see the Python/Tkinter code snippet at: [URL]http://www.daniweb.com/code/snippet693.html[/URL]

Member Avatar for fredzik
0
140
Member Avatar for fredzik

If you use Tkinter there are over a million different colors to pick from. [code=python]# select a color from the color dialog and color the root window # there are also a few named colors Tkinter can use directly: # "white", "black", "red", "green", "blue", "cyan", "yellow", "magenta" from Tkinter …

Member Avatar for fredzik
0
143
Member Avatar for jrcagle

Thanks Jeff! I had made myself a note when using PIL and Tkinter not to use 'from Tkinter import *' but the simple 'import Tkinter as tk' to avoid namespace conflicts with Image. Your other observations are rather astute!

Member Avatar for aot
0
6K
Member Avatar for aot

Don't use a label, use a text widget ... [code=python]# just a way to display long text import Tkinter as tk def display(data): """creates a text display area with a vertical scrollbar""" scrollbar = tk.Scrollbar(root) text1 = tk.Text(root, yscrollcommand=scrollbar.set) text1.insert(0.0, data) scrollbar.config(command=text1.yview) scrollbar.pack(side='right', fill='y') text1.pack(side='left', expand=0, fill='both') root = tk.Tk() …

Member Avatar for Lardmeister
0
109
Member Avatar for leeqiang

Under tools there is an update option, makes sure you have at least version 1.8.0.0 of Pyscripter. The older versions had trouble with wxPython, not quite sure why, since Pyscripter is written with Delphi.

Member Avatar for leeqiang
0
115
Member Avatar for vegaseat

Did you know C# has its own scripting language based on Lisp, here is an example ... [code];;; Scripting a 'C#'' GUI with Lsharp, free from [URL="http://www.lsharp.org"]www.lsharp.org[/URL] (reference "System.Windows.Forms") (reference "System.Drawing") (using "System.Drawing") (using "System.Windows.Forms") ;; Create a form (= form (new System.Windows.Forms.Form)) (set_text form "Hello from Lsharp") ;; Create …

0
69
Member Avatar for fredzik

In a GUI print and input are replaced by label and entry components. Here is a typical example ... [code=python]# a simple Tkinter number guessing game from Tkinter import * import random def click(): # get the number in the entry area num = int(enter1.get()) # check it out if …

Member Avatar for fredzik
0
162
Member Avatar for dav_yip

[quote=woooee;337419]Try a="itself ‘a parody’."[/quote] The problem is that US keyboards don't have a left and right singlequote character, so you need to escape the hex value of the character. This works in Python ... [code=python]x = 'itself \x91a parody\x92.' print x # itself ‘a parody’. [/code]If you feed string x …

Member Avatar for katharnakh
0
153
Member Avatar for Vrb

Here is one book I would not recommend: "C# How To Program" by Deitel I wasted $85 on this thing. It is uninformative and the index is written by a 4 year old!

Member Avatar for pygmalion
0
343
Member Avatar for liz517
Member Avatar for sneekula
0
124
Member Avatar for nitinloml

Please wrap your code in code tags, so it preserves the indentations and looks somwhat like Python code! See: [URL]http://www.daniweb.com/techtalkforums/announcement114-3.html[/URL] For Python code on Daniweb: Please use the [b][noparse][code=python][/noparse][/b] and [b][noparse][/code][/noparse][/b] tag pair to enclose your python code. Note, no spaces in [code=python]

Member Avatar for vegaseat
0
95
Member Avatar for AussieCannon

For me using Boa is simply too frustrating. I rather create a template and use that to flesh out into a program. Here is a template that does something similar to what you want, experiment with it. [code=python]# the wxChoice() widget, a simple dropdown box # select a color choice …

Member Avatar for jrcagle
0
560
Member Avatar for aminura

It depends how sophisticated you want to get. If it is a simple text based console program, you can make an array of strings. Each string contains let's say eighty characters, all spaces but for one asterisk. It will be your genius to place the lonely asterisk at the right …

Member Avatar for WaltP
-1
3K
Member Avatar for mouigher

You mean something like this ... [code=python]def kilo(): kilometers = input("What is the distance in kilometers?:") return kilometers def miles(km): """calculates miles from kilometers km""" miles = km * .62 return miles def main(): print "This program converts kilometers to miles." km = kilo() print miles(km) main() [/code]

Member Avatar for mouigher
0
460
Member Avatar for Blujacker

The wx.ScrolledWindow class manages scrolling for its client area, transforming the coordinates according to the scrollbar positions, and setting the scroll positions, thumb sizes and ranges according to the area in view. There is also the wx.lib.scrolledpanel.ScrolledPanel() widget that expands on wx.ScrolledWindow.

Member Avatar for Blujacker
0
1K
Member Avatar for sneekula

Yes linux, that would be the simplest way to do it! Python allows you to pass functions as arguments to a function. This code might give you more flexibility ... [code=python]# giving a Tkinter Button command two (or multiple) functions to run import Tkinter as tk def do_two(s, f1, f2): …

Member Avatar for aot
0
3K
Member Avatar for AikoYamamato

The Python language itself depends heavily on highspeed mappings called dictionaries. Strings are used as keys and have to be immutable objects. Jeff is right, it takes a while to sink in. You actually should store your result in a variable ... [code=python]from string import Template s = Template('$who has …

Member Avatar for AikoYamamato
0
181
Member Avatar for Suplexx

I think you are talking about a bread and butter item of Python. Your child-script is called a module and you import into your parent-script. Take a look at: [URL]http://www.daniweb.com/techtalkforums/post287241-87.html[/URL]

Member Avatar for vegaseat
0
132
Member Avatar for Logi.

Note that the images are objects not strings, so you have to do this ... [code=python]import Tkinter import random import Image, ImageTk def changeImage(): global listOfImages im = listOfImages[random.randint(0,8)] box1Label.configure(image=im) top = Tkinter.Tk() r7 = ImageTk.PhotoImage(file="gfx/r7.jpg") b7 = ImageTk.PhotoImage(file="gfx/b7.jpg") A = ImageTk.PhotoImage(file="gfx/A.jpg") B = ImageTk.PhotoImage(file="gfx/B.jpg") C = ImageTk.PhotoImage(file="gfx/C.jpg") f = …

Member Avatar for vegaseat
0
1K
Member Avatar for Lardmeister

If you don't want to change your original function you can attach a decorator just above the function as shown ... [code=python]# intercept a wrong data type with a function decorator def require_num(func): """decorator to check if a function argument is a number""" def wrapper (arg): if type(arg) in (int, …

Member Avatar for jrcagle
0
645
Member Avatar for jrcagle

I don't use IDLE much, but mostly the DrPython IDE. I know IDLE has some problems with firewall settings, could that be it?

Member Avatar for vegaseat
0
168
Member Avatar for scru

My new machine has Windows Vista OS and I can't get Tkinter to work, but wxPython works fine ... [code=python]# create a background image on a wxPython panel # and show a button on top of the image import wx class Panel1(wx.Panel): """class Panel1 creates a panel with an image …

Member Avatar for vegaseat
0
2K
Member Avatar for chris99
Member Avatar for vegaseat
0
819
Member Avatar for jrcagle
Member Avatar for kiethnt
Re: help

I used a similar library for Delphi and it worked well. Here is the C/C++ counterpart. "Windows Std Serial Comm Lib for C/C++" (includes XP), a shareware download from: [URL]http://www.sharewareconnection.com/windows-std-serial-comm-lib-for-c-c-.htm[/URL]

Member Avatar for vegaseat
0
100
Member Avatar for jwintersmith

With mutable objects like lists and dictionaries you have to be careful with direct assignments. Yes, it makes a copy, but a copy that shares the same address. [code=python]>>> a = [1,2,3] # this makes b an alias of a, they both share the same address >>> b = a …

Member Avatar for vegaseat
0
112
Member Avatar for bops

Do you want to do this in C or C++. For C++ see the code snippet at: [url]http://www.daniweb.com/code/snippet225.html[/url] With C you have to slug it out in the trenches! Not too hard to do, just labor! A word can end with a space, tab, period, comma, semicolon, newline, ? or …

Member Avatar for Narue
0
180
Member Avatar for Blujacker

You need to give us the full code, or we won't know where 'plot' is coming from.

Member Avatar for vegaseat
0
261
Member Avatar for Blujacker

wxPython comes in an ansi and a unicode version, you need to install the unicode version.

Member Avatar for Blujacker
0
207
Member Avatar for sneekula

Searching our own Python snippet section there are several hits under 'wordcount' and word frequency. These snippets are probably more complex than what you need, so here is a very simple way to do it ... [code=python]# Chinese wisdom ... str1 = """Man who run in front of car, get …

Member Avatar for vegaseat
0
118
Member Avatar for itajit
Member Avatar for vegaseat
0
116
Member Avatar for sneekula

Python's floating point precision is that of a double in C (about 16 digits). For higher precision you can use the Python module decimal.

Member Avatar for vegaseat
0
165
Member Avatar for danizzil14

Just in case others are interested, to exit a program use ... [code]import sys sys.exit() [/code]or easier ... [code]raise SystemExit [/code]

Member Avatar for ghostdog74
0
166
Member Avatar for scru

Please use the [B][noparse][code=python][/noparse][/B] and [B][noparse][/code][/noparse][/B] tag pair to enclose your python code. Otherwise you lose all your indentations and you code becomes unusable! With the housekeeping out of the way, "Welcome to the Python forum!"

Member Avatar for scru
0
824
Member Avatar for Xzantose

[quote=jbennet;312794]yeah i would like to point out now that nothing you make in .NET will run on linux easialy if at all[/quote]There is an open source project called MONO that allows .NET stuff to be run on the Linux operating system. I think the name MONO came from the effort …

Member Avatar for blacklight
0
145

The End.