Hi,

The last time I posted I think I asked too many questions and the main reason that I posted got lost somewhere amongst other side issues.

The main reason I posted last time is the following:

# The following code is not a game, it is configured just to test a GUI concept. 
num=10
running = True
run=""
while running:
guess=int(raw_input('Enter a number between one and ten : '))
if guess!=num:
print " Number 1"
print
print " Number 2"
print
print " Number 3"
print
print " Number 4"
print
print " Number 5"
print
print " Clue No.1"
print
print " Clue No.2"
print
print " Clue No.3"
print
print " Clue No.4"
print
print " Clue No.5"
print "---------------------------------------------------------------------------"
if guess==num:
print " EXCELLENT!!!!!"
break

Can this "program" be put into a vertical scrolling Text Widget using place?

I have no idea how to code the above "program" as there are zero examples to work with. I don't even know if "place" functions inside a "vertical scrolling Text Widget" as there is no documentation to say that it can. It has instead "tag", "mark" and others.

I assume from what little I know about Tkinter that the "vertical scrolling" function is merely a sheath over the parent Text Widget and works in a similar way as a List box vertical scrolling function would...but the question is, does the "tag" or "mark" etc take over where "place" would normaly do the job and how does one code the above according to these rules?

Thanks in advance.

fredzik.

Hi again,

Two times I've posted recently and both times when I've put the code in as one should in the "Message" box it starts to have problems. I think it's got something to do with the new way that the code has been looking of late. Has there been a new program installed in the "Message" box also?

Note:

I've just tried out the above code and it looks all wrong because of the "Message" box problems. The way the GUI should look can be found at the following address: http://www.daniweb.com/techtalkforums/thread79511.html

Sorry about the mix ups, there must be some teething problems with the new system.

Thanks,

fredzik.

Notice that in this article place() does not work in the text widget, but you are shifting the entire Text widget partially out of the window. This way the window becomes a view into an area of the the text widget. Actually quite interesting.

Hi,

Yes indeed, although not installed within a working program as such, it none the less works with or in conjunction with the Text Widget unlike when say pack and grid are placed together within a program they tend to conflict with each other and either hang, freeze or even crash the program.

The "place" problem may necessitate the following type of solution:

from Tkinter import *
root = Tk( )
string = Text( )
string.config(font=('courier', 15, 'normal'))                 
string.config(width=20, height=12)
string.pack(expand=YES, fill=BOTH)
string.insert(END, '                                                    Why are these\n\n')   
string.insert(END, '                                                    words situated\n\n')
string.insert(END, '                                                    over here?')
root.mainloop()

Although not by any means an elegant way of coding, but simply by the use of sheer brute force i.e. pushing the strings to one side of the window thereby producing the desired effect. This, I came across not through any book or website etc, it was simply through experimentation on my console game, because the game necessitated that "clues" be located to one side of the window.

Thanks,:)

fredzik.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.