Can not add button, etc in form. Form has 4 frames and one canvas. Can generate form, but button is not on frame?
--------------------------------------- - from tkinter import *
-
def Plot():
-
root = Tk()
-
root.geometry('1340x690+00+00')
-
root.title('Equity bSelection')
-
# top border controls
-
frame1 = Frame(width=1340, height=200, bg="light green", colormap="new", borderwidth=0)
-
#Button(frame1,text='Plot List', command=sys.exit).pack(side=LEFT) #command=dispplotlist
-
#but1=Button.config(height=3, font=('times',20,'bold'))
-
frame1.pack(side=TOP,padx=0,pady=0)
-
-
# bottom border time scale
-
frame2 = Frame(width=1340, height=50, bg="light green", colormap="new", borderwidth=0)
-
frame2.pack(side=BOTTOM,padx=0,pady=0)
-
-
# left border controls
-
frame3 = Frame(width=50, height=450, bg="orange", colormap="new", borderwidth=0)
-
frame3.pack(side=LEFT,padx=0,pady=0)
-
-
# right border scales for $, and non-$
-
frame4 = Frame(width=100, height=450, bg="silver", colormap="new", borderwidth=0)
-
frame4.pack(side=RIGHT,padx=0,pady=0)
-
-
# charted lines
-
canvis1 = Canvas(root, width=1240, height=450, bg='light gray', borderwidth=0)
-
canvis1.pack(padx=0,pady=0)
-
Plot()
-
mainloop()
---------------------------------------------------
5 1361 bvdet 2,851
Recognized Expert Moderator Specialist
Why create separate frames? Shouldn't root be their parent? - from Tkinter import *
-
def Plot():
-
root = Tk()
-
root.geometry('1340x690+00+00')
-
root.title('Equity bSelection')
-
# top border controls
-
frame1 = Frame(root, width=1340, height=200, bg="light green", colormap="new", borderwidth=0)
-
but1 = Button(frame1,text='Plot List', command=sys.exit) #command=dispplotlist
-
but1.config(height=3, font=('times',20,'bold'))
-
but1.pack(side=LEFT)
-
frame1.pack(side=TOP,padx=0,pady=0)
-
-
# bottom border time scale
-
frame2 = Frame(root, width=1340, height=50, bg="light green", colormap="new", borderwidth=0)
-
frame2.pack(side=BOTTOM,padx=0,pady=0)
-
-
# left border controls
-
frame3 = Frame(root, width=50, height=450, bg="orange", colormap="new", borderwidth=0)
-
frame3.pack(side=LEFT,padx=0,pady=0)
-
-
# right border scales for $, and non-$
-
frame4 = Frame(root, width=100, height=450, bg="medium blue", colormap="new", borderwidth=0)
-
frame4.pack(side=RIGHT,padx=0,pady=0)
-
-
# charted lines
-
canvis1 = Canvas(root, width=1240, height=450, bg='light gray', borderwidth=0)
-
canvis1.pack(padx=0,pady=0)
-
Plot()
-
mainloop()
For: bvdet
Your posted answer created button on form not on frame! -
from tkinter import *
-
def Plot():
-
root = Tk()
-
root.geometry('1340x690+00+00')
-
root.title('Equity bSelection')
-
# top border controls
-
frame1 = Frame(root, width=1340, height=50, bg="light green")
-
-
but1 = Button(frame1,text='Plot List', command=sys.exit) #command=dispplotlist
-
but1.config(height=3, font=('times',20,'bold'))
-
but1.pack(side=LEFT)
-
frame1.pack(side=TOP)
-
-
# bottom border time scale
-
frame2 = Frame(root, width=1340, height=50, bg="light green", colormap="new", borderwidth=0)
-
frame2.pack(side=BOTTOM,padx=0,pady=0)
-
-
# left border controls
-
frame3 = Frame(root, width=50, height=450, bg="orange", colormap="new", borderwidth=0)
-
frame3.pack(side=LEFT,padx=0,pady=0)
-
-
# right border scales for $, and non-$
-
frame4 = Frame(root, width=100, height=450, bg="medium blue", colormap="new", borderwidth=0)
-
frame4.pack(side=RIGHT,padx=0,pady=0)
-
-
# charted lines
-
canvis1 = Canvas(root, width=1240, height=450, bg='light gray', borderwidth=0)
-
canvis1.pack(padx=0,pady=0)
-
Plot()
-
mainloop()
============================================
Your code work; created button on form and removed frame?
bvdet 2,851
Recognized Expert Moderator Specialist
I don't know what you are trying to do. Do you want a separate top level widget to contain the button?
There is 4 frames top, bottom, left, right, and canvas in center! Top and left frame will contain buttons, select lists etc. to control plot on canvas. Right frame will contain printed scales for $ amount and other units of measure.
Bottom frame will contain time scales, day, week etc.
Canvas well contain plot of equities and stock indicators.
The reason I want separate frames is to control vertical, and horizontal placement of controls with pack on each frame.
there well be no controls on canvas; only drawing of lines with colors and other attributes. I need 4 frames to control packing for each.
In my code the button seems to be on form and not on frame1; the green color is missing!
bvdet 2,851
Recognized Expert Moderator Specialist
You could arrange your frames and canvas on one top level window. I don't get it.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Stephen M. Gava |
last post by:
Hi all,
I prefer using tkinter to wxpython (so sue me :) and i need to display a
lot of html in a particular app. does anyone know if one of the existing
add on tk html widgets have been wrapped...
|
by: Ankit |
last post by:
Hi guys i need to make a table to store a certain data using
Tkinter..I have searched on the group but i have not been able to find
a solution that would work for me..The thing is that i want my...
|
by: psbasha |
last post by:
Hi,
Is it possible to create a simple viewer using Tkinter Modueles?.
If not ,is it possible thru Python and OpenGL or anyother ways of creating a simple viewer?.
I would like to have the...
|
by: alivip |
last post by:
I integrat program to be GUI using Tkinter I try browser direction
as you can see
# a look at the Tkinter Text widget
# use ctrl+c to copy, ctrl+x to cut selected text,
# ctrl+v to...
|
by: Kenneth McDonald |
last post by:
Any guesses as to how many people are still using Tkinter? And can
anyone direct me to good, current docs for Tkinter?
Thanks,
Ken
|
by: Guilherme Polo |
last post by:
2008/5/10 Kenneth McDonald <kenneth.m.mcdonald@sbcglobal.net>:
I will say no to the first question.
Now about the second question.. there are these links you may find interesting:
"An...
|
by: viv1tyagi |
last post by:
Hi everyone ! ! !
I'm just a month old in the world of Python and trying to develop an
application using Tkinter in which a new window pops out on a
particular button press.The code for this new...
|
by: J-Burns |
last post by:
Hello. Im a bit new to using Tkinter and im not a real pro in
programming itself... :P. Need some help here.
Problem 1:
How do I make something appear on 2 separate windows using Tkinter? By...
|
by: mcfly |
last post by:
I can apply my python code using import tkinter within the python shell and it works perfectly (i open some file using tkinter). however, when i try to run the file.py from the command prompt...
|
by: sthirumgn |
last post by:
how to give coding to radio buttons while using for gender
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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,...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |