Is there a showcase (demo) application with all Tkinter and Tix features and widgets?
For example, wxPython download includes a "wxPython Demo" application which not only demonstrates the widgets, but also provides the source code and some comments on it, which I liked a lot.
But now I have to stick to Tkinter and Tix only, and as of those - there is some real good documentation, even with patterns explained, but there is no a showcase I could find, so I basically have to copy-paste lots of code from docs to my sample app to understand what it looks like in real.
P.S. Tix is really wanted, not only Tkinter...
check this message:
http://groups.google.com/group/comp.lang.python/msg/0b42abf092120140
The Python wiki page on TkInter is a good starting point - listing many resources. The TutorialsPoint site seems to be one of the few that gives a reasonable visual overview of the TkInter widgets. Also there is an overview of the basic tk widgets on the tcl.tk site.
Related
I'm trying to make a volume controller in python tkinter. But what exactly the problem is that, I want to make it look rich and professional. So when I tried using tkinter scale widget, it worked. But the widget is just a normal one. I wanted to know a way to make it look like the image below I have sent.
My current one's code is this:
def slider(self):
self.scale = scale = ttk.Scale(self.canvas, from_=0, to=100, orient=HORIZONTAL)
print(self.scale.winfo_class())
self.scale.place(x=580,y=455)
self.scale.set(70)
Is there anyway I can make it look better like the one in the Image?
What all things I want is:
A knob like round thing like in the image which is movable
Some color should fill in the area that is already covered.
A pop up or anything to show the current details of the volume.
I'm using pygame to play music in tkinter btw..
If this isn't possible, please suggest me a better way/alternative to do this. Thank you.
As far as I know, there is no existing widget with a look exactly like what you are asking for. However, tkinter provides a way to craft your own widget styles, which might make it possible to do what you want.
Tkinter comes with a module named ttk, which stands for "themed tk". It allows you to define custom styles for individual widgets, and to bundle those styles into a collection known as a theme. If you want to create a widget with a custom look, you can use this module to do so.
Unfortunately, being able to design a custom theme for a widget isn't very well documented. The best documentation I personally know of is on tkdocs.com, in the section Styles and Themes. It gives a pretty good rundown of the terminology and overall description of how themes work. The python documentation for ttk also gives some additional information about creating styles and layouts in a section titled Ttk Styling.
For inspiration, you can check out the code for the ttkthemes project (github, public documentation) which has many different themes that you can examine. I doubt there is one exactly like you want, but you should be able to create your own after looking through the examples.
It is as easy as setting a theme for the TkInter project. Done in Python it looks like that:
s.theme_use('themename')
You might benefit from reading Styles and Themes documentation of TkDocs.
I'm in a dilemma. I've got a python code that works for each of the yellow squares shown below but I want to make an application that looks like below and uses the information from the first text box and the second drag and drop box. Then depending on what the user clicked on, the code for that would run. I'm not sure how to approach this. Any help would be greatly appreciated!
You can use Python GUI libraries like:
Tkinter
PyQT
WxPython
Kivy
Pyglet
(This list is not exhaustive.)
Each has their own advantages and disadvantages. Choose the one that fits your project the best.
My personal recommendation for your particular project would be Kivy.
Hi I was wondering if anyone could answer my question, how would I go about making a game with graphics in python instead of text based games.
I'm only new though so if it involves another programming language then I'm probably can't do it yet.
Use tkinter module inside of python. To do this simply add from tkinter import * at the start of your program and open a window and use a mainloop to close it at the end. You can research how to use tkinter online on various different websites. I would suggest effbot as it's very useful for tkinter basics.
I would recommend using the tkinter library. You can makes games with graphics instead of text. One example would be here. And it is just Python :)
I'm developing a python/tkinter application, and finding the default messagebox lacked flexibility, I programmed my own using Toplevel.
I was rather successful in recreating the messabox appearance, however, I could not find a way to obtain the icons displayed in normal tkinter messagebox (i.e. : error, warning, info icons...)
I did some research didn't find much, except that those image were stored in a win32 DLL file... Also tried looking into the tkinter messagebox module code, but its only an interface transferring from python to TCL code I can't find (and probably wouldn't be able to read anyway...)
Is there anyway to get files or rough equivalents (PhotoImage objects) for these icons using either python or TCL executed though Tk().tk.call()?
Or any other (thourghly explained then) way to achieve this?
Right now the best solution I can think of is to use screencapture, and save the icons to files, but I'd rather be able to access the original ones...
Thanks in advance !
The rough equivalents are available as (tk global variables):
::tk::icons::warning
::tk::icons::error
::tk::icons::information
::tk::icons::question
Like anything that is not documented, it is subject to change in the future, but these should be stable.
I'm looking to design a (very) basic GUI for a battleship game.
As suggested in another question, I was going to use Tk's check buttons and coordinates and pass the value and so forth.
I'm having a tough time finding a decent start-up tutorial for Tkinter. I've tried Google and went through several results to little to no avail. Though I'm pretty experienced with Python, I've never done any GUI (other than lightly with Xcode). If anyone knows any good resources, I'd really appreciate it.
"Programming Python" by Mark Lutz has a chapter on GUI's.
The tkinter page on the Python wiki has links to tutorials as well.
tkdocs.com has a tutorial that covers tkinter (as well as using tk with Ruby, Perl and Tcl).
For what you need I suggest you look at the canvas widget
There are several resources: e.g. - http://www.techrepublic.com/article/tkinter-canvas-freeform-guis-in-python/6310698 or http://effbot.org/tkinterbook/canvas.htm