Hi,

I'm puzzled by how one positions in Tkinter. Take a look at the following code:

print "...................................Hello, world!"

This works fine in the Main Idle but when it comes to Tkinter I'm confused:confused: . The game I'm working on has about 30 "clues" dotted all about the screen. About four fifths of the "clues" are situated in one place and stay there. The other four or five "clues" change position on the right side of the screen as one scrolls down frame after frame with each frame divided by a line. The problem I'm having is that the Tkinter documentation is not to clear on how to position these 30
"clues":icon_cry: . Do I use "grid" or "place" or "pack" or do I use so many pixels to the left or right :confused:.
I'm still sticking by Tkinter come hell or high water:S I just hope someone can post me some code on how to achieve this type or a similar type of positioning...:)

One more thing, is it just my eyes or are the new smilies blurry:?:. If they really are blurry then they should call them not smilies but blurries!!!

Thanks for helping,

fredzik.

Of the three layout managers, I find grid() to be the most user-friendly.

Jeff

(But Vega's advice is always sound, so go with place ... :))

Hi again,

Excellent!!! Excellent!!! And Excellent!!! And can I say another word of gratitude to Vegaseat...um, Excellent!!! (ah, can't think of another word):icon_cheesygrin:!!! Believe it or not THIS was the very reason that I was so VERY reluctant to take on Tkinter as the GUI of choice for my game as I'd been googling about for around two months:icon_eek: :icon_eek: for the answers to what I needed. What I needed was the "absolute co-ordinates" with "Label" and "place" and pixel placements. Being an absolute beginner at programming (I only started eight months ago) I wasn't too sure of the right terminology I should use to describe my needs.

Thanks also to Jeff for your input as well. I usually google for at least ten hours per each problem in search of answers before coming here. But I find my answers here in super quick time but I don't want to take up too much of anyone's time as there are others :confused: in just as desperate a need of solutions as I am.

To Mr. Vegaseat, please SIR, allow me to buy you lunch one time (not kidding this time!) as this has saved me a tremendous amount of time and effort, the only problem is that I'm in Australia and it might take some time to get over there and I might be late for lunch!:icon_rolleyes:

Thanks,

fredzik.

place seems to be a nice and easy way for positioning, but it's not often used. e.g. think of what happens if you want to make some little changes to the GUI. You have to change all coordinates of (mostly) _everything_ you positioned :icon_wink:

BTW, you can use a combination of layout managers. I often do the following: separate the main window into frames and position them with pack. Then, fill these frames with widgets using pack or grid, depending on the complexity of the layout.

Hi Mawe,

Thanks for your suggestion:), but I think it best if I don't refer to this GUI as a GUI anymore, it's more like a large list box that one can scroll up and down in. This game I'm working on has 50 turns which means that it has 50 frames with various "clues" given in them along the way. To solve a number problem on frame 32 might mean scrolling back to say frame, 12 because there are certain "clues" given at 32 which make more sense at frame 12. One has to play detective to solve the ten puzzling numbers.

The frame around the large list box may have a marble-like effect to give it a nice GUI - like look, but in reality it will be nothing more than a glorified list box similar to the Main Idle but of course with a different background and maybe coloured "clues". It may sound like a complicated game but in reality it's really fairly easy to play and takes about ten to fifteen minutes to play each game. Remind me Mawe to send you a free game later when it's finished.

But I agree with Mawe in this regard, as each new frame comes up some of the positions of the "clues" (remembering that there's 0 to 7 clues per frame) which will tend to fatten or squeeze the frame just as it does in the Main Idle when I play it there. Is there some way to automatically update the window so it won't throw out the other functions of the window, that is, if I'm using labels or whatever? Or will this glorified list box be more suited to something other than labels?

To give you a clear idea of what this list box (if indeed it should be called a list box:-/) should look like please refer to my earlier post which has that "game" with 5 entry numbers and simply multiply by ten and this'll give you the length of the game. BTW that "game" is completely different to the one I'm working on now and only the list box? and postioning of numbers etc is similar.

Thanks,

fredzik.

Hi again,

When one thinks of a game it is usually in a GUI type of window stuck in one place and things have to be done in it or to it (such as chess etc) it is not usually moveable. Conversely a game can be like a Pygame where things move about the screen and one shoots at them or whatever.

Neither applies to my game:S. I have not seen a game where one scrolls down a UI to play a game. I could be wrong, and am by no means an expert in this matter, this is just my humble opinion on what I've seen on the games market. If I'm wrong please email me.

My game should have the following or it won't work:

No.1 It has to be scrollable.
No.2 It has to come up on screen as large as Python's Main Idle.
No.3 It has to have pretty coloured words and numbers so it's nice to look at:) .

I think the confusion might lie in the fact that in most people's minds they have preconcieved ideas of what a game is and should conform to, ideas already known, tried, and trusted. Maybe I'm stepping out into the unknown with a scrollable game like this but I find it fun to play and I don't mind the scrolling part as long as it gets to the answers I need. As each frame is numbered one can make a mental note of when this or that particular "clue" was seen and the scrolling part is really a minor inconvenience.

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.