473,696 Members | 1,913 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to place menu on the bottom

#!/usr/bin/env python

import sys
import os

from tkinter import *

def callback(self):
#int this snippet, all menu entries use the same callback...
print("callback ")
class DemoMenu():
def __init__(self):
self.dataTemp = ""
self.createWidg ets()

def createWidgets(s elf): # create application GUI
self.rootWin = Tk()
self.rootWin.mi nsize(width=800 , height=600)
self.rootWin.ma xsize(width=800 , height=600)
self.rootWin.ti tle = ("JoeQ Menu test...")

self.mainFrame = Frame(self.root Win)

self.createMenu ()

def createMenu(self ): # create menu
menuFrame = Frame(self.root Win)
menuFrame.pack( side=BOTTOM, fill=X)

menuBar = Menu(menuFrame, tearoff=1)

filemenu = Menu(menuBar, tearoff=0)
filemenu.add_co mmand(label="Op en...", command=callbac k)
filemenu.add_se parator()
filemenu.add_co mmand(label="Ex it", command=callbac k)

menuBar.add_cas cade(label="Fil e", menu=filemenu)

self.rootWin.co nfig(menu=menuB ar)

return menuBar

def start(self):
self.rootWin.ma inloop()
if __name__ == '__main__':
demomenu = DemoMenu()
demomenu.start( )
############### ############### ############### #########
I want to place the menu on the bottom (menuFrame.pack (side=BOTTOM,
fill=X)). But it does not work. Why?
Aug 30 '08 #1
3 1403
qx******@yahoo. cn wrote:
self.rootWin.co nfig(menu=menuB ar)
I want to place the menu on the bottom (menuFrame.pack (side=BOTTOM,
fill=X)). But it does not work. Why?
menubars that are configured via the window menu option are rendered by
the underlying window system.

to create a stand-alone menu bar, create a frame and pack or grid it
where you want it, then add Menubutton widgets to it, and attach your
pulldown menus to those buttons.

the following wrapper supports both menu styles; look at the "else"
clauses in the various "if use_native_menu s" statements for code samples:

http://svn.effbot.org/public/stuff/s...nter/tkMenu.py

</F>

Aug 30 '08 #2
On Aug 30, 6:04*pm, Fredrik Lundh <fred...@python ware.comwrote:
qxyue...@yahoo. cn wrote:
* * * * self.rootWin.co nfig(menu=menuB ar)
I want to place the menu on the bottom (menuFrame.pack (side=BOTTOM,
fill=X)). But it does not work. Why?

menubars that are configured via the window menu option are rendered by
the underlying window system.

to create a stand-alone menu bar, create a frame and pack or grid it
where you want it, then add Menubutton widgets to it, and attach your
pulldown menus to those buttons.

the following wrapper supports both menu styles; look at the "else"
clauses in the various "if use_native_menu s" statements for code samples:

http://svn.effbot.org/public/stuff/s...nter/tkMenu.py

</F>
step1: I first create a widget "menuFrame" which is belong to the
rootWin
....menuFrame = Frame(self.root Win)
step2: then I put the widget to the bottom of the rootWin
....menuFrame.p ack(side=BOTTOM , fill=X)
step3: I create a menu belong to the menuFrame.
....menuBar = Menu(menuFrame, tearoff=1)
since menuFrame should be placed to the bottom, so does the menuBar in
my opinion. What the problem is?
Aug 30 '08 #3
qx******@yahoo. cn wrote:
What the problem is?
the menu is drawn by the window system when you use the "menu" option,
not by Tkinter.

</F>

Aug 30 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1960
by: Veerle | last post by:
Hi, I have a menu at my page. This menu is at the top of my page and at the bottom of my page. The html for this menu is the same for the top menu and for the bottom menu, I only gave them a different id, so that could position them absolutely in my css: <div id="menu-top"> <a class="menuitem" href="index.html">menuitem 1</a> <a class="menuitem" href="page2.html">menuitem 2</a>
2
5301
by: RWD | last post by:
I am trying to figure out how to change the target frame in my hyperlink on a DHTML menu. The menu is in one frame and the target frame is called "main" The code is below: Thanks in advance RWD <script type='text/javascript'>
2
3889
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at http://home.pacific.net.sg/~jacksony ? (the drop down bar could not work at www.apchosting.net but can drop at home.pacific.net.sg. I suspect it is a server problem but was told it is not possible, therefore assuming it is a client script problem? the script works last time...
0
1479
by: Garmt de Vries-Uiterweerd | last post by:
X-posted to opera.page-authoring, because this is a bit Opera-specific for the moment. F'up to ciwas. I am playing around with dedicated styling for the projection media type.. Currently the only browser to support it is Opera, which uses projection when in full-screen mode. On a website I maintain (http://www.jules-verne.nl/), I have set up some special styles for projection. Not that this specific website really needs it, but...
1
2669
by: Edward | last post by:
I created a simple CSS layout (code and example below) for bloggin/writing but ran into five issues that I need help with: 1. How do I get rid of the right-margin red line on the last three right-boxes in Internet Explorer? 2. How can I put a 4px margin BETWEEN the right-boxes, "border-top: 4px" didn't do it and if I put in a "margin-top: 4px;" it shows the red underneath instead of the brown background graphic.
2
2276
by: Ravi Joshi | last post by:
The menu on my site works fine in IE6 and Firefox. In IE7, there is a problem with the menu: when you mouse over the various main catagories, the sub-catagories all appear to the right as they should; however, as soon as you mouse towards any but the TOP sub-catagory, all those sub-catagories still view there. It will work first time quite fine..but if user clicks outsite anywhere in screen then this problem occur.. i think it's css...
0
3139
by: mjohnson0321 | last post by:
I am trying to incorporate a CSS drop-down menu into a site (suckerfish menu). The menu gets lost behind the content below it, but only on one of the drop downs (News). The error occurs on all of the browsers I have tested it on (IE6, IE7, Firefox, Opera and Safari). It is probably something simple, but I can't find it! Here is the CSS (using external style sheets): style-temp.css (Main style sheet for the site): * { font-family:...
1
1520
by: CKich30 | last post by:
When viewing my page (siuehockey.net) in Firefox, it's setup how I want it to look. When i viewed it using IE, the menu at the top runs into the "Cougar Hockey/cougarhockey.net" at the top left. It's leaving off two menu selections: Contact, and Cougar History, which when loading the page get covered up by the banner picture. Here's the CSS for the site: body { margin: 0; padding: 0; background: #000000 url(images/img01.jpg)...
7
5554
by: milestogofromhere | last post by:
It is late so this is probably something really obvious but I am not seeing it. Can someone please help? Here is the page in question: html - http://www.itsyourplate.com/index2.php css - http://www.itsyourplate.com/thin.css As you can see from the file the menu is showing up vertically not horizontally. I copied the code directly from another site I have done and changed the bullets (I didn't want any) and the colors but I must have...
0
8666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8597
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9145
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8880
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7703
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3033
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2319
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1992
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.