#user-interfaces
1 messages · Page 22 of 1
that is my output
whenever i click the random name button, nothing happens
it might be a stupid mistake but i have no idea what is going wrong
@wise rapids are you free to help?
...or anyone...
@fallen oxide
@shrewd orbit
I have no idea how to code
oh ok
I'm not even sure what I should do
whats the best python gui
haha
hahaha
ha
no.
Alright, to be completely serious, there isn't really a "best"
some of them are fairly bad, and some of them are acceptable
nothing will knock your socks off
how about tkinter?
really bad
fuck
PyQt is popular here
ive been using that xD
tkinter is just a pain in general
ill switch
which isn't surprising considering its TCL origins
anyway, PyQt is hard to install and harder to distribute
the choice is ultimately up to you but the gui landscape isn't great
any other suggestions?
Not really
PySide is more or less in the same boat
Wx is abandoned
GTK is a mess
...tkinter is a mess
im at lost than.. RIP
tkinter will work fine if you can figure it out
it's just a mess and doesn't look great
pyQt is gr8, expect for the camleCase
camelCase sad
They're correct to stick with it at least
😦
sad
the hell guido van rossum))) , so long time and still have not at least not painful gui library with id and normal behavior. Fuck the effects and super new futures, just give us make buttons labels and switchers comfort way. gui do)
@obsidian lance Tkinter is really old, originally written for Tcl. Guido has said he's interested in replacing it but so far he hasn't found a gui library he likes
@fallen oxide How long has it been said?
I'm not sure
Not really
:| then my fonts in browser or web version of discord is problem?
hope guido choose something flexible for python gui. The python is interpretator , and dinamicaly typed language as i understand
and hope he choose it before we all stay old and not functional)))
Now it's up to GDUDE, to make C extensions and make a GUI API
It all makes sense now
haha
need push to guido , think little faster about gui do. May be he worry about the gui which he was choose/create can be not enought good as his name consonance). hope he not plane do gui all life)
Hey, I would like to some advice from you about my idea. I am going to make a task sheduler for myself. I have an equation which still needs work on cuz I am trying to make a perfect one. Tho atm I just want to test my equation with giving values to my variables.
That being said, I want to see my results in gui as well.
Which Gui library and additional libraries should I use? I wanna add timeline and Graph as well..
If your just doing a timeline and graph, and simply displaying data, matplotlib is your guy
Otherwise, any of the GUI APIs will work just fine for that
@honest torrent Thanks.
the console on spyder freezes all the time.. any suggestions?
@digital rose you use spyder for python development?
some times ago i try use spyder... it will comfort... but not long time, ... bugs crushes etc. Now i use pycharm community or vscode + python extension, all free and have under linux/win os
Most people don't want Kivy, it has a very specific target audience
PyQt has been nice to me
I use Notebooks.. occasionally Spyder
@cloud sedge my first app for android i try to make use kivy.... i complete coding ,then few weeks or even close month summary i try to find way that make apk , and no result... windows too and linux too... only kivy lancher and run from source ))). After this i kick this shit off. and learn the haxeflixel... close year ago. few weeks ago i remake my kivy app use haxeflixel and publish it on google play. Before this i third time try to make apk from kivy again, with new!!! version of kivy... and result was same...))) . be careful with this. But slider widget on kivy is cool :|. but without apk is cool only less 10%) not more
and no man ask me why kivy can't do that... and way of create kivy apk is real ugly... like shamanic dance coding
kivy still no good support python3 , it is real
99% kivy users use it with python2 , and this bad, because python3 released close 10 years ago
and documentation of kivy is poor , but have irc channel
i agree with Zwack, PyQt5 has been good to me
was even able to use pyinstaller with it to get a standalone exe
You guys should look at Eel (posted in #python-discussion earlier as well) if you are already familiar with HTML and js
It's quite light but should be suitable for small apps
Hi, am new to python, and i need some help with my script, i guess it's pretty simple , i just still don't have enough knowledge.. Well it's a little script that solves quadratic equations
and i want the result to appear on my window
not in pycharm
Here is the code
import cmath
from tkinter import *
from tkinter import ttk
def equasolution(*args):
value1 = float(a.get())
value2 = float(b.get())
value3 = float(c.get())
dp = "Les solutions de l'équation sont: "
dn = "Pas de solutions"
dz = "une seule solution"
d = ((value2**2) - (4 * value1 * value3))
s1 = ( -value2-cmath.sqrt(d)) / (2*value1)
s2 = (-value2+cmath.sqrt(d)) / (2*value1)
s = (-value2) / (2 * value1)
if d > 0:
print(dp, s1, s2)
else:
if d < 0:
print(dn)
else:
if d == 0:
print(dz, s)
root = Tk()
root.title("EQUA DEGRE 2")
mainframe = ttk.Frame(root, padding="50 50 120 120")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
mainframe.columnconfigure(0, weight=1)
mainframe.rowconfigure(0, weight=1)
a = StringVar()
b = StringVar()
c = StringVar()
a_entry = ttk.Entry(mainframe, width=7, textvariable=a)
a_entry.grid(column=1, row=1, sticky=(W, E))
b_entry = ttk.Entry(mainframe, width=7, textvariable=b)
b_entry.grid(column=1, row=2, sticky=(W, E))
c_entry = ttk.Entry(mainframe, width=7, textvariable=c)
c_entry.grid(column=1, row=3, sticky=(W, E))
ttk.Button(mainframe, text="Calculate", command=equasolution).grid(column=3, row=5, sticky=W)
root.bind('<Return>', equasolution)
root.mainloop()```
almost correct
remember the language name after the first backticks
```python
your code
```
then you get syntax highlighting :)
okay lemme try again
YAY, thanks
now, tell us what problem you're having with this code
I posted a screenshot, I want the result of the equation to appear on my window, not in pycharm
well, when you do print() it will print stuff to sysout, in this case that means pycharm
so instead of doing those print statements, you're gonna want to push that information into an element in your gui
so you basically have to create some sort of element to hold the information you wanna display, and then update that element with the correct info.
I'm actually not that well versed in tkinter so I'm not sure which element type to use off the top of my head
Thank you , what do u think is better for a GUI ? PyQt or Tkinter ?
pyqt for sure
everyone around here loves it
but it's a bit more complex, though
a little more learning
but that shouldn't scare you. :)
from a quick google, it looks like a label is indeed the way to go
Hmm , okay i'll see
I finally did it !!
Thank you @rugged sinew for helping me, i really appreciate it, what u said was useful :))
Well, here is the code
import cmath
from tkinter import *
from tkinter import ttk
def equasolution(*args):
value1 = float(a.get())
value2 = float(b.get())
value3 = float(c.get())
dp = "Les solutions de l'équation sont: "
dn = "Pas de solutions"
dz = "une seule solution"
d = ((value2**2) - (4 * value1 * value3))
if d > 0:
s1 = (-value2 - cmath.sqrt(d)) / (2 * value1)
s2 = (-value2 + cmath.sqrt(d)) / (2 * value1)
solution = "s1 = " + str(s1) + "\n s2 = " + str(s2)
else:
if d < 0:
solution = "Pas de solutions"
else:
if d == 0:
s = (-value2) / (2 * value1)
solution = "s = " + str(s)
result_text.delete("1.0", END)
result_text.insert(END, solution)
root = Tk()
root.title("EQUA DEGRE 2")
mainframe = ttk.Frame(root, padding="20 20 70 70")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
mainframe.columnconfigure(0, weight=1)
mainframe.rowconfigure(0, weight=1)
a = StringVar()
b = StringVar()
c = StringVar()
solution = StringVar()
a_entry = ttk.Entry(mainframe, width=7, textvariable=a)
a_entry.grid(column=1, row=1, sticky=(W, E))
b_entry = ttk.Entry(mainframe, width=7, textvariable=b)
b_entry.grid(column=1, row=2, sticky=(W, E))
c_entry = ttk.Entry(mainframe, width=7, textvariable=c)
c_entry.grid(column=1, row=3, sticky=(W, E))
result_text = Text(mainframe)
result_text.grid(column=2, row=8, sticky=(W, E))
ttk.Label(mainframe, text="La valeur de a").grid(column=2, row=1, sticky=(W, E))
ttk.Label(mainframe, text="La valeur de b").grid(column=2, row=2, sticky=(W, E))
ttk.Label(mainframe, text="La valeur de c").grid(column=2, row=3, sticky=(W, E))
ttk.Button(mainframe, text="Calculate", command=equasolution).grid(column=3, row=5, sticky=W)
result_text.insert(END,solution)
root.bind('<Return>', equasolution)
root.mainloop()```
no problem. good job!
@steady spade why lot of people prefer use sqrt(x) , but not ```
x**(1/2) or x**0.5
suarerooting and multiplying something by 1/2 are 2 very different things
He's not multiplying
** is the power operator
and yeah, the square root of something is just that thing to the power of 0.5
the reason is because using the power operator looks like shit in comparison :P
Python is all about readability and the way your code looks
so yeah, that's why
@fallen oxide wasn't like that when i sent that message :)
He edited, he just had 0.5x and 1/2x
ah okay
can i mimic this sort of table in tkinter?
https://comfy.moe/nhuugu.png
i tried using treeview, but i cant seem to insert anything except text into the columns
so i cant put a progressbar
im trying to make a download manager gui thingy... so the design seems really fitting, but i couldnt find any probably way make it behave like so
@digital rose @fallen oxide at first i type double asterisk and not use triple ` syntax and text was bold and distorted
@long crystal You'd need a real gui lib for that, probably
alternatively you'd have to write your own widget
no short way man
you think its possible with wx maybe?
even kivy, hard to use, but have lot of widgets , not allow you fast do that like html etc
wx, don't know, i use it few times, but use only buttons and text input fields
well, it seems so superfluous - every torrent, download manager and program that can download stuff primarily has those
o.o
they mostly use GTK
but even then you usually need your own widget
nobody said UI work was easy
how can one make their own widget? ;-;
at least you will must create table create cells , may be table strings , and addon progress bar , text , etc in loop for every string
then create this like class file , mymagictable... and make instance t=mymagictable(...trulala...), if all will work done)
for example tkinter have frame and two elements... summary 3 elements , which can be used like box for other widgets
i forgot last two... frame, may be scrollpanel etc... and my memory last other info)
o,o this is confusing... i practically have to make it out of other widgets, right?
you create frame... it can't displayed... like transperent rectangle... you will type something like
f=Frame()
t=mymagictable(f,....) #this your own created class, where "f" is parent link or something
as result your table will displayed as part of Frame
i know what a frame is ;v im just trying to understand the process of creating said widgets
the situation can be little worst... may be you can only create own big widget from prebuild little parts not more... but i am not sure
self.table.setRowCount(1)
self.table.setColumnCount(4)
self.table.setItem(0, 1, QtWidgets.QTableWidgetItem('test')) # row, col
```
how would i make it so that the table isin't editable
i tried
self.table.NoEditTriggers
but it does nothing
Wouldn't you just setEditable(False)?
self.table.setEditTriggers(Qt.QTableWidget.NoEditTriggers) # Can't edit but can select.```
@polar olive thank you that works
had to do
self.table.setEditTriggers(QtWidgets.QTableWidget.NoEditTriggers)
appreciate it
nice
such horrible controls
i'm going to change the controls once i finish the basics of the program
then im gonna revamp it and give it a better look
Looking forward to see the progress
honestly
almost all the features work
besides the spritesheet feature
i might as well make the program look better
time to design it in photoshop
Oh nice, I am pretty amazed by what computers can do.
It looks pretty good so far!
nice job
thanks
the blue bar wont be there
it will be a normal bar
but you get the point
development is coming along really nicely!
Can someone help me in python3?
i don't like kivy as much
Show your progress M2?
I haven't got done much
I'm about to work on the settings window + the import and stuff
Keep those updates coming, really interesting to see this at work whilst learning something different. Widens the horizons of what Python can really do.
yeah
i'm finally getting to work on this window
i'm gonna make it bigger though
Oh very nice, so you are initially creating your own Photoshop?
not really
its more of the animation part of asesprite
and adding that with photoshop
is basically asesprite
Hmmm I see.
So you create buttons with code and hyperlink them, though the design alone sits with Photoshop?
i just use two different programs
photoshop and this animation program created by me
i might make my own pixel program some day
Hi, i finally compiled my python file to exe, but when i run it, the command prompt shows with the program, is there any way to hide it?
Yea, but now, i run the exe file, and the command prompt shows up with the program, and i was asking if there is a way to hide it
Yes If You Compile the exe with the --noconsole Option .....
Like i wrote in the Screenshot
am sry , u're right
The Alternative would be calling os.fork() and Then killing your Parent Process
Thank you
@steady spade pyinstaller yourscript.py --onefile --noconsole
if app is base python only , without external libs then will onefile.exe
sad, but no easy way to do this syntax with pyqt app, but can with wxpython, tkinter case
i was wondering if i can design a GUI layout in photoshop, and then code it somehow in python, i don't know if this is possible
no way to do this fast... i not pro ... only way i know make what you want is use kivy.org (but in real this is shit, because it still work only with python2 good, python 3 still can't be properly converted to apk etc... only for kivy launcher and run from source)
but you can use tkinter widget and make buttons + image... but it will not fast (bad docs for tkinter and examples is not nice)
I see, that's sad :((
and for future
- pyinstaller create linux app only under linux, windows exe only under windows
-tkinter can run crossplatform code (win ,linux) but gui will look different , margins borders etc
-wxpython can run crossplatform code but with bugs... windows add new element on top , but linux on back... it look like shit), and you need fix your code.
-pyqt work done, but you need installed qt on each machine when you want run your app in case of pyinstaller. And you need qt + pyqt on each machine when run source. this huge
@steady spade this mind , at this moment python have no comfort gui lib...still have no
I guess there must be a way to import a custom GUI and then code it somehow, idk..
this is magic dance with drums. We need native gui, but guido don't like any present libs, or other reason don't swith tkinter to another
Guido has said that when something nicer than tkinter comes along which he likes then tkinter will be gone
tkinter is abnormal) . This only gui lib i know which have no default ID parameter for widgets... it look ready mad first time)))
and unicode displaing symbols problem make it worst...
If PyQt was pythonic, I bet it could have been implimented
i must recode each unicode symbol with number greater then 65535 to plain text string because tkinter can't display this... because tkinter ooold
what a fake)... the python 3 presented as full unicode support, but tkinter can't this... 0:)
Very nice. 
thanks
Looking good!
Nice one
tkinter
for tkinter that's pretty sick lmfao
yeah but i needed something like this for 2d sprite making
the spritesheet is what i found online
this version looks really close to my original design
of course i added a few extra things like a menubar
and im gonna edit the # sprites to be STARTxEND
like 2x5
@placid sable tkinter linux look, look better then windows
It's looking good!
^
wait a minute
i'm done
i just can't get fps right
but other than that
its done!!
created with tkinter (no ttk) and pil
only 287 lines of code
damn that's awesome 😄
I agree
no way, @steady spade , when you use grid , then all cells will have biggest value..... if you have widgets with width 100 px , 50 px , 25 px, the grid result will 100x3 cells.
read about .place() method
Okay, thank you
https://hastebin.com/ofuhirufab.py I have the following code that I want to display a very simple animation of a box falling down. I know the generating part works, because if I use mainloop, it displays the first image. However when I want to create the actuall animation, a box pops up with nothing in it
Is there a better GUI lib to do this with? I can also access the RBG values of each pixel
@honest torrent remember ... gui is not python way at this time... no good gui lib for python
Well, I know that
python is server or console/terminal
Although PyQt is decent
And python can still be used for GUIs
Take dropbox > they use python for their desktop app
so does Cura, 3D printing software
Well of course
https://hastebin.com/ofuhirufab.py
- at first you use "global img"
- at second you delete global image
- at last you create new image , but what if destroy() method not erase image but delete object like "del img" then you create a local var inside function.
but i am not sure
I use global img because it's not worth making a class
It doesn't delete the img from what I know, simply removes it from the gui
do you try just redefine img? ```python
print("Plz Display")
if img is not None: #no need
img.destroy() #no need
img = tkinter.Label(root, image=tkpi)
img.place(x=0, y=0, width=s.width, height=s.height)
sure
Hi, i made a program that does the "ctrl+s" shortcut automatically in every period of time (you choose that period of time in the beginning)(i did it so i don't forget pressing ctrl s every time when am using photoshop or illustrator), i used a while loop to do that, but my GUI starts lagging when i try to quit ..
import pyautogui
import time
from tkinter import *
def ctrlspress(*args):
t = float(n.get())
while t > 0:
time.sleep(t)
pyautogui.hotkey('s')
root = Tk()
root.geometry("200x120")
n = StringVar()
Entry(root, textvariable=n, width=15).pack(side=LEFT)
Button(root, text="ACTIVATE", command=ctrlspress).pack(side=TOP)
Button(root, text="QUIT", command=root.quit).pack(side=BOTTOM)
root.bind('<Return>', ctrlspress)
root.mainloop()
The issue is fixed.
Was it an easy fix, or something painfully obscure? I know I've been bitten by some tkinter bugs in the past glares at shared variable option menus
@unkempt scroll It was an easy fix, i used the tkinter after() method to make a loop instead of the "while loop"
@steady spade i think about pause between loops in while but look like "after()" can work better... i don't know , cause not use in even once
damn i'm late
i had a similar problem with my sprite animator
but yeah the after method works fine
While loop was probably blocking the gui. Your code never gave any control back to GUI code to react to button presses and etc.
Hi, I'm trying to add a timer to my program, for example if i want the program to press CTRL+S every 10 minutes, i want the timer to start from 10 min and go down to 0. Here is the code:
import pyautogui
import tkinter
from tkinter import *
import tkinter.font as tkFont
root = Tk()
root.title("AutoSave")
n = StringVar()
def ctrlspress():
global after_id
global t
t = int(float(n.get()) * 1000)
pyautogui.hotkey('ctrlleft', 's')
after_id = root.after(t, ctrlspress)
def definet():
global t
t = int(float(n.get()) * 1000)
definet()
sec = str(t)
def tick():
global sec
sec -= 1
time['text'] = sec
time.after(1000, tick)
def start_loop(*args):
t = int(float(n.get()) * 1000)
root.after(t, ctrlspress)
def STARTALL():
start_loop()
tick()
def stop_loop():
global after_id
if after_id:
root.after_cancel(after_id)
after_id = None
root.rowconfigure(1, weight=1)
root.configure(bg='#2f3542')
helv22 = tkFont.Font(family='Helvetica', size=22, weight='bold')
helv15 = tkFont.Font(family='Helvetica', size=15, weight='bold')
bn1 = Button(root, text="Start", font=helv15, command=STARTALL, width=40, height=4, bg='#222f3e', fg='white').grid(column=0, row=0, columnspan=4)
bn2 = Button(root, text="Stop", font=helv15, command=stop_loop, width=40, height=4, bg='#222f3e', fg='white').grid(column=0, row=6, columnspan=4)
L1 = Label(root, text="Save every", bg='#2f3542', fg='white', font=helv22).grid(column=1, row=5)
entry = Entry(root, textvariable=n, font=helv15, width=9).grid(column=2, row=5)
L2 = Label(root, text="seconds.", bg='#2f3542', fg='white', font=helv22).grid(column=3, row=5)
time = Label(root, width=8, height=2, bg='black', fg='white', font=helv15)
time.grid(column=1, row=8)
root.bind('<Return>', start_loop)
root.mainloop()```
In line 16, i try to do sec = t , but i get the error : t is not defined
It looks like this with sec = 60 https://imgur.com/95jjK9Z
t isn't defined
before you use any functions
it trys to set sec = t
t is only defined in a function
so for that to not error, you would have to call a function first or define t before the line "sec = t"
my explaining isn't the best so i'll make an example
def create():
tissue = 5
toilets = tissue *2
create()
Tissue wouldn't be defined until create() was called
and since create was called after you tried using tissue
it would error
def create():
tissue = 5
create()
toilets = tissue *2
#create()
now it's defining tissue in the function before using it
tissue = 1
def create():
tissue = 5
toilets = tissue *2
create()
another solution would to be just to define tissue
without a function
@steady spade hope this helps
@sudden stone It's still an error, but i added "global tissue" then it worked, but for some reason i still don't have it working in my program
def create():
global tissue
tissue = 3
create()
toilets = tissue*2
print(toilets)```
It prints 6 in the output
now t is defined, but the new error i get is "n is not defined", since
t = int(float(n.get()) * 1000)```
is n defined on startup?
if you put a number into the field before start it won't happen
I updated the code above, now n is defined on startup
n = StringVar()```
edit broke smth
Its better to format it so that function are at the top before any other code, currently you have them all over the place.
Running the edited version (that you changed after my message) brought multiple new bugs, I would roll back to previous one 😄
In that version the reason why you got "n is not defined" error was because you didn't enter a number into N"Save every N seconds" field.
You could use IntVar() instead of StringVar() as the values should be only integers anyway, that will also mean that n.get() will give you an integer directly, you won't have to convert it manually.
Thank you
meh created simple calculator
pure tkinter
only image is the icon
from tkinter import *
lol the only thing i imported
a few things i could do to it to make it better
like repeating decimals
I like it
hello m2, i like it a lot but i feel like you should replace - with / and + with * so then the most used buttons + and - will be closer to the = button 😄
this is useful for people who want to do quick calculations with minimal mouse movement 😄
okay thanks for the tip!
no problem 😄
hey @sudden stone i saw your sprite tkinter application too and i really liked the flat dark theme 😄
i would now replace - with / 😄
no problem at all my friend 😄
hey do you think it'd be possible for me to introduce a flat dark theme to my program too or would it be too difficult with my layout 😄
@sudden stone 😄
remove border of widgets ? 😮 never looked into that, how do I do that 😄
thank you btw 😄
and set the foreground color (for textbox, button, label) to change the text color
bd=0
i am so very inspired by your design 😄
❤
yeah it did
.config(font=("Arial", 15))
i don't know if the default font was arial but
in my design i made in photoshop i used arial
thank you so much 😄
i tried applying that .config to the root but it didnt work 😄 do you apply it to each individual widget
well i do a loop for parts that are pretty much the same
and use the index to place them
like in the calculator
ohhh 😄 dynamic i love it
settings = Toplevel(master)
settings.attributes('-topmost', 'true')
settings.configure(background=background_color)
settings.title(TITLE)
settings.geometry(f"{SETTINGS_GEOMETRY[0]}x{SETTINGS_GEOMETRY[1]}")
settings.iconbitmap(ICON)
i have only done that once before but i used .place(x=0,y=0) and added a fixed amount depending on the height/width of the widgets before it 😄
and thank you for that 😄
yeah that's how i created the settings window
and when the button was pressed it would call the function
and create it
what hex color codes did you use for the dark parts 😄
sorry if i am asking too much here 😄
thank you 😄 i will work on my gui now
and nope! not right now 😄 thank you for your help
good luck! be sure to tag me when you share i cant wait to see
i will 😄 thank you so very much
np!
i think im gonna rewrite this to be done in a loop instead first 😄 i am so very angry at myself for writing this
anyone know how to fix the ugly text on tkinter on high dpi screens?
left is tkinter, right is default Windows text
@sudden stone here it is so far, any suggestions? 😄
and now it is all done in a loop 😄
looks nice!!
thanks m2 😄
@sudden stone Does your calculator only work with buttons or also corresponding keyboard input?
i'm lazy so the only way you can do keyboard input is by typing it in lol
that would be a cool idea thoug
i might actually do that
one is east and one is west
opposite directions
imo you should use grid
and put them on the same row, differect column
class SongFrame(wx.Frame, tags.File):
TypeError: multiple bases have instance lay-out conflict```  OwO What's this?
Basically, you're doing multiple inheritance, but it's not clear which class should be used for unoverridden functions and variables
there's a conflcit, basically, they declare some of the same things
can't do that
what you want is a mixin, probably
I don't think I want to use wx.Frame anyways though
I need like, some kind of seporator
I'm curious as to why you're even inheriting tags.File
Just, a box that I can put a grid in
Because I think using self.name might be easier
I could always do self.song.name though
True that
The tag lib was weird though
I had to do py import pyprinttags as tags tags = tags.taglib
prbly because it uses Cython
https://gist.github.com/anonymous/e34360488ff5cfacf85fce5099397c4b Whenever I attempt this, it opens a window with no content, and doesn't have the SongFrame in it
Hi, i'm moderately comfortable with the basics of python, but i don't know anything about adding a gui to my program, where should i start?
Thanks, will do
@mild flame be careful... tkinter have poor docs and abnormal structure... the widgets have no "id" parameter etc...
i don't think this good point to start... tkinter is compact and prebuilded (as result you can just "pyinstaller script.py --onefile --noconsole" and have onefile exe windows / linux package) but this is all good places of tkinter... For example tkinter widgets can't display unicode characters with number greater then 65536 (for example if you want display message from email you will fail often without manual recoding symbols with number > 65536 to coded string)@mild flame
What alternatives are there to tkinter?
^
pygame....no
PyGI for GTK+3
PyQT and I believe wxPython both support native platforms quite well
I hear about kivy often
I've used it before
Same
Worked on a game with two friends two summers ago. Was a top-down dungeon crawler
it doesn't have good gui stuff bundled with it, so I would have to make everything myself
@drifting sundial what do you mean by support native platforms quite well like GTK3
Worked pretty well, but managing everything got out of hand, manging objects was getting ridiculous
what's a gtk3
GTK3 is a GUI framework like Qt and wxWidgets are
GTK3 is written in C, Qt in C++, wx too I think? Tk (tkinter) in Tcl
GTK isn't a window manager lol
I've only heard about it in the context of linux guis for the most part, so I assumed it was a window manager lol
Yay learning 😅
Why should I switch from tkinter aside from better unicode support?
Tkinter looks ugly
And isn't native on any platform
even windows?
its portable and somewhat easy to get started with
but looks ugly on every platform
i dont understand why people would use pygame for guis
i personal like using tkinter
tkinter is good for small apps imo
yeah i made some cool stuff
Pygame isn't a GUI framework. Pretty much nobody uses it for GUIs
A graphics framework isn't a graphics user interface framework
calculator with tkinter
it could be
pretty simple lol didnt do much with it
Not really. To be a GUI, you have to provide direct warppers for widgets
Being able to make your own widgets doesn't make you it a GUI framework
pretty proud of this
https://i.imgur.com/r0d4AJ3.gifv
this is what the settings look like (back when fps was broken)
the only image was the icon and the canvas background
i love canvas
❤
looking real good, @sudden stone
o thats cool
Best GUI to create a chess game?
They'll all do it, but Qt is the nicest overall toolkit
pygame
Pygame isn't a GUI framework. You can embed it in a Qt window
You can also do \ to nullify formatting
\~~tkinter~~
~~tkinter~~
You can type backslash normally if it's followed by a space
yes
but not if it's followed by a ~
to say \~ you have to say \\~
this is getting off topic...
yes
@echo lagoon not tkinter i think. tkinter is for simple button app with text . And can't display unicode with number greater then 65535
@obsidian lance TKinter is much more than enough for a simple Chess-Game 🤷
look like you right... solomon)
ok
tkinter is fine imo
isn't aurora 4x basically made with the same level of gui complexity?
Tkinter is just very, very old
It's originally from the Tcl days, and was designed for Tcl
And for some reason there's a Python wrapper for it
Tcl is long dead, though
I mean, it works I guess
Just about, yeah
Also, while we're here, I should mention that I attwmpted to put the GUI I posted a while back into a module
GUI applications aren't usually suitable candidates for modularisation
You can do that if you're running them in their own right
But since every GUI library has its own main event loop, you just can't really use them in something else
So just cram all the GUI code at the top of the file and ignore it?
Haha, not really what I meant
You can modularity within your application
Just don't build it with the intention of making an API for another app
Ah okay, yeah
Just wondering if I were to replace tkinter with another gui framework what would be an easy one to switch to in your opinions?
Nothing is really exactly like Tk
But that's a good thing for the most part
Qt is a popular one
Does it allow custom shaped guis?
I think so idk how to put it in english
Custom size?
Like custom placement/shaped of the minimized and quit buttons?
Most likely, although I have not used QT
No
Qt is designed to integrate with the system it runs on
You can hide the titlebar if you really want and draw your own icons, but I can't think of a good reason to do that
Going to ask there: is there any way to move buttons to certain shape in Appjar?
@fallen oxide isn't appjar like tkinter?
nvm
ignore i said anything lol
did some research
I'm looking to make a game. A handful of buttons, and a window with vector graphics. Which will be modified during gameplay. Kind of like the old Flash games? Any recommendation of what GUI I should look at ?
I've used tkinter without issues, although others have said that pyqt is better
I'm wondering if I should check out "Unity" actually...
Apparently it uses .NET. And then you can use IronPython.
Good luck with that, lemme know if that works out for you.
How hard can it be? 😉
¯_(ツ)_/¯
Did someone say to use pygame, pyqt, tkinter, or just learn c#?
Joseph, what did you try to make?
Ironpython had been abandoned for many years @barren siren
I tried to make fluid
aw
If you're using Unity, use C#
....so, pyqt looks interesting
Qt is interesting
PyQt is also interesting
they should've named it QtPy for Cutie Pie but okay
You're looking to make a game, pyqt is gui
...yes?
PyQt is no use for game development
It can make static interfaces and stuff, but it's just not got the right features for game dev
ahhhh.
People really need to understand the difference between graphics libraries and graphics user interface libraries
Well, I just wanted to do something simple. Like a flash game without the flash. The important part is vector graphics and vector animation
Essentially, for game dev, knowing C# is a must, either if you go down the route of using your own graphic engine or using something like unity
C# only for unity. C++ otherwise
I wasn't aware that pyqt had no graphical abilities beyond buttons and stuff, but tkinter does have a canvas widget with drawing tools
C# is good for monogame too
@shell blade pyqt has canvases too, just canvases have little ability of themselves and are too low level
If you want to make a simple game with python, use pygame. Nothing gets simpler than SDL2
pygame has terrible GUI support iirc, isn't embedding pygame into tkinter or pyqt a thing as well?
Yes it is
Make a basic Qt UI, embed the pygame surface into a frame
There's also pyglet of you want some direct OpenGL action
Though OpenGL is sort of awful
He said he only wanted basic vector graphics
Why not literally just write a flash game?
Nothing wrong with that
The problem was never with flash, it was always the flash plugin itself
Different lang and different workflow, but flash is quite accessible.
Flash games work without it
Flash is just JavaScript. Similar enough to python that it shouldn't be too hard to learn
Flash is dying. I literally can't get flash games working under linux, and under windows I had to download a specific player. Time to move on.
Do you mean online Flash or Flash itself
Might as well use HTML5 and WebGL or something if you want to feel newer
I still play flash (muh anecodtal evidence), and there are still popular flash game sites like kongregate and miniclip, but this is getting kind of off topic either way
Can you do animated vector graphics in HTML5 and WebGL?
Oh another option if you want a low level vector graphics environment I've had success with
Is pycairo
Cairo is bloody awesome
Hearing you not criticise something is promising 
😅 I'm opinionated
lol
What is it?
Cairo (stylized as cairo) is an open source programming library that provides a vector graphics-based, device-independent API for software developers. It provides primitives for two-dimensional drawing across a number of different back ends. Cair...
Cairo has been the go-to solution for custom graphics for the GTK stack
Had to use it because GTK doesn't provide an image widget that is resizable so I had to draw a Cairo surface that could reload and resize the pixel buffer from my image of choice as I resized the window
Though I wasn't using it with python, I was using Cairo with Vala but looking at pycairo guides
Would it be your first choice outside of GTK though?
They have similar APIs
Yes
If I want something low level, definitely Cairo. It's wicked fast and flexible
I only got to know about it because of GTK but Cairo itself is used in a lot of places
If it's fast, then I'll definitely keep it in mind if I need a fast graphics thing
Hi, if I want to create 2D and 3D graphs in a GUI, would tkinter+matplotlib be the best combination for that?
dunno how matplotlib works for builtin 3D graphics, but with some math of your own, I'm sure tkinter+matplotlib is suitable
well tbh I don't actually know how to do 3D in matplotlib
Well, with some math I'm sure it's possible
but I found documentation for mplot3d
I'm more worried about tkinter bcs I'm having trouble finding nice examples
I want to make it y'know, extravagant
but for now I only know how to make a simple calculator
Well, if you like my tkinter GUI, I have a gif of its functionality posted in #303934982764625920
It's surrently configured to be used for text though, but you could easily switch out the central widget with matplotlib
the theme toggle is so cool
yeah, it was a bit of a pain to figure out, but it's nice
Adding your own themes is pretty easy too
I could just DM you the template if you wanted, @kindred bluff
I would appreciate that
Aight
Matplotlib works great with 3d
@kindred bluff
sudo apt-get install python3-matplotlib
thanks 😃
@kindred bluff np, and can use "rmouse -> mention" on user logo picture, that mark message red symbol in new message list of user. It allow separate message flow if lot of people talk same time
Hey there.. What is the best python framework for building gui?
there are quite a few, and it's mainly about personal preference
some of the well known ones are tkinter and PyQt
it also depends on what platforms you want to run it on.
for example: I'm 90% sure you can't (easily) export tkinter to android
Yeah, that's "good luck with that" territory
otherwise, tkinter and PyQt are safe bets for any desktop platform.
Was this helpful, @dense whale?
what about wxPython
Pretty sure it's not maintained @kindred bluff
what do you mean by maintained?
because an update seems to have been released like two weeks ago
checks
Huh, you're right
I was under the impression that WX itself was unmaintained but I guess not
does someone perhaps know why the 3d plot starts wiggling when you hover over it?
@kindred bluff pastebin.com too please :)
hastebin > pastebin
@dense whale tkinter is prebuilded, but can't show full unicode letters, as result if you try show unfiltered message from your email in tkinter widget you will fail. remember it. and tkinter have not default "id" parameter. It insane , but you can emulate it by hand coding
@spare verge what is gist?
@fallen oxide just for comfort, don't want save file on my pc or use editor
sorry didn't see the message immediately
yes, gist look pretty , need test once
@obsidian lance https://pastebin.com/2SEth3ge is this good?
I'll take a look when I get home, if it's not solved by then.
I've noticed that if I make the buttons bigger than the graph it works
but then the buttons looks weird
enought , and your english comments good as mine)))
btw, what does sticky=nsew actually do?
self.btn = tkinter.Button(self,text='Izlaz', command = izlaz)
self.btn.pack(ipadx=125)
self.btn = tkinter.Button(self,text='button')
self.btn.pack(ipadx=125)
why you use same name for different objects?
self.btn1 self.btn2 will be better i think
I'm not sure tbh
the code is kind of an abomination that I made using whatever I could find online
and glued it using the limited knowledge I have about tkinter and classes
@kindred bluff digging of window is result of change numbers in coordinate toolbar... look like you need fix it width or format numbers
try this
self.btn = tkinter.Button(self,text='Izlaz', command = izlaz,width=100)
self.btn.pack(ipadx=125)
self.btn = tkinter.Button(self,text='button',width=100)
self.btn.pack(ipadx=125)
this is hardstyle solution)
you can use not 100 but 99 in width
you are the boss)
how do entries work? I'm trying to replace input with entry so that everything is done within the GUI
have you looked at the tkinter documentation yet?
oooh, I was looking at the wrong page
I'll check that out now
yeah that didn't help really
I've been trying different stuff by replicating what I saw online but I can't seem to do it properly.
If someone could help make it so that the t=linspace(start, end, points) is defined using entry, I'd be really grateful
+1 for wx widgets ... yesterday i change my gtk colors for ubuntu that make all folder background black. And wx application , started on my ubuntu stay black too
tkinter still grey
?
@obsidian lance if you'd used GTK instead of wx, your thing would have followed your GTK theme completely :p
@wanton tangle can i just use same python code + GTK, that create linux + windows app , with available just "pyinstaller myscript.py --onefile --noconsole" and have monofile executable for os?
Well, for one, you shouldn't be creating single file python executables for Linux. Ever
Linux comes with python preinstalled and has ways of ensuring you have all the packages you need
Linux is not windows, shouldn't treat it as such
And no, GTK doesn't work very well with windows. But for GTK based distros, which happen to be the most common ones, it is significantly better than wx or Qt
ok
prepare to see many post from me
im going to transfer my game to python instead of c#
not much i gotta do to make that transformation
im more experienced with python & pygame than c# & monogame
gotcha
if you plan on making any fairly detailed game, though, I recommend staying away from pygame
pyglet and cocos2d are both much much faster than pygame (the reason mainly being batching together draw calls, where pygame enforces you blitting everything seperately)
so you vsay pyhlet and cocos2d are much faster than python
oops
you mean pygame?
yeah sorry
pyglet is a framework, cocos2d is a game engine
cocos comes with things like actions, screen effects, backgrounds, animation management, menus, etc
isn't pyglet more for 3d?
it can be done in 3d, though I've seen more instances of 2d in it than 3d
just a word of advice for optimization, make sure that each new sprite is in a Batch, but make sure the amount of sprites/images in a Batch doesn't exceed 50
hopefully you'll learn how to use Batches later on, but in summary, Batches make the sprite blitting much faster, because it blits all sprites/images in that Batch all at once
graphics libraries, and graphics cards for that matter, don't particularly like it when they get draw call after draw call. they like it a lot more when all the data they need is coming in at once
about
cocos2d is a framework for building 2D games, demos, and other graphical/interactive applications.
huh
never knew they considered themselves a framework for such broad use when a lot of their stuff pertains to game actions
im hearing that pyglet isn't python 3
...huh?
pyglet works just fine with python 3
I don't remember if I used a wheel/egg or if I just pip installed but I'll check right now
yep, pyglet works absolutely fine in python 3
ok thanks
Anyone here used tkinter?
Unfortunately. But not in detail.
well you see
the details were lost in therapy
I've come across a interesting problem
The left one only works on linux
The right only works on windows
fml
Anyone got a fix to make the module name no caps?
I'm pretty sure it's lowercase on all platforms
The uppercase is likely a C module wrapper
gonna guess you're not using the same version across systems
if you're using the stock python command on rpi then it's going to be 2.7
I just do alias python=python3.5 (once py3.5 is installed) to alias python to python3.5
gonna have to drop that in your .bashrc though
yep, though make sure that command works first
If you want 3.6 you'll need to either add it to your repositories and dl it or build it manually for 3.6.4
If you need it
Na 3.5 will do fine
Ya
are there any popular apps that is fully made with python (if thats possible). 😄
GUI ones not that much there are some less known but good ones in pyqt
apps in general hell yes
k .thanks
most major apps will use a combination of technologies and languages
not pure python
but google, dropbox, youtube, spotify and reddit use a ton of python.
i love that tkinter isn't up here lol
have any of you guys tested gooey?
it looks like a fun idea.
I wanna make a home automation gui..... Is it better than tkinter?
looks neat
@uneven echo For that, a web UI would be more suitable since you'll be able to access it from any device
@wanton tangle I'm using Ifttt webhook
So I can do it for tasker, a python script etc
IFTTT is fun
My friend is an admin on IFTTT
I swear you have friends who are admins everywhere
agreed
If This Then That, an automation service, off topic tho
welp, I'm officially done with tkinter
moving on to kivy
oh boy, installation errors
Hello?
Hello
https://pastebin.com/Y3pfvAWi Do you know how to collect data from textboxes?
for the record, just ask your question in future
no need to check if someone is here
K
Yeah, because you're doing ent.get, not ent.get()
get is a function
you do have to call the function
print(ent.get())
yes
LOok def create_window():
root = Tk()
root.title("Write your Note")
ent = Entry(root, width=100).pack(side=TOP, padx=100, pady=100)
b = Button(root, height=1, width=10, text="save", )
b.pack(side=LEFT, padx=2, pady=2)
root.mainloop
def save():
print(ent.get())
It stillwont print
Are you calling save() anywhere?
It doesn't look like it
you're also not calling mainloop()
*facepalm
It looks like you haven't done a Python tutorial - are you doing Python at school or something?
I am self teaching and using tutorials from lynda.comand youtube. This is a dumb mistake
If you'd prefer a book, try Automate the Boring Stuff with Python
K
LIke This def create_window():
root = Tk()
root.title("Write your Note")
ent = Entry(root, width=100).pack(side=TOP, padx=100, pady=100())
b = Button(root, height=1, width=10, text="save",command=save())
b.pack(side=LEFT, padx=2, pady=2)
def save():
print(ent.get())
root.mainloop()
OK, but now you're calling save() when you don't want to be
it should just be command=save
HEy. I have been working my program down to this final error: "C:\Users\Talkcom Inc\PycharmProjects\Randomizer\venv\Scripts\python.exe" "C:/Users/Talkcom Inc/PycharmProjects/Randomizer/venv/Lib/RANDOMIZER.py"
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Talkcom Inc\AppData\Local\Programs\Python\Python36\Lib\tkinter_init_.py", line 1699, in call
return self.func(*args)
TypeError: save() missing 1 required positional argument: 'ent'
Opps
I meant "C:\Users\Talkcom Inc\PycharmProjects\Randomizer\venv\Scripts\python.exe" "C:/Users/Talkcom Inc/PycharmProjects/Randomizer/venv/Lib/RANDOMIZER.py"
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Talkcom Inc\AppData\Local\Programs\Python\Python36\Lib\tkinter_init_.py", line 1699, in call
return self.func(*args)
TypeError: save() missing 1 required positional argument: 'ent'
If you are going to post code in Discord, please use syntax highlighted blocks, as it makes it more legible for other users.
To do this, you should input your content like this:
```python
print("Hello world!")
```
This will result in the following:
print("Hello world!")
but withou the python thats for highlighting
'''"C:\Users\Talkcom Inc\PycharmProjects\Randomizer\venv\Scripts\python.exe" "C:/Users/Talkcom Inc/PycharmProjects/Randomizer/venv/Lib/RANDOMIZER.py"
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Talkcom Inc\AppData\Local\Programs\Python\Python36\Lib\tkinter_init_.py", line 1699, in call
return self.func(*args)
TypeError: save() missing 1 required positional argument: 'ent' '''
Opps
blank line after triple `
How do i go downa line
just enter if you are in a codeblock
i mean its a codeblock it was made with keeping in mind people will do newlines there
"C:\Users\Talkcom Inc\PycharmProjects\Randomizer\venv\Scripts\python.exe" "C:/Users/Talkcom Inc/PycharmProjects/Randomizer/venv/Lib/RANDOMIZER.py"
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Talkcom Inc\AppData\Local\Programs\Python\Python36\Lib\tkinter\__init__.py", line 1699, in __call__
return self.func(*args)
TypeError: save() missing 1 required positional argument: 'ent'
there we go
That is the last error
ok can you show us the defintion of the save method plus the way you call it?
"C:\Users\Talkcom Inc\PycharmProjects\Randomizer\venv\Scripts\python.exe" "C:/Users/Talkcom Inc/PycharmProjects/Randomizer/venv/Lib/RANDOMIZER.py"
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Talkcom Inc\AppData\Local\Programs\Python\Python36\Lib\tkinter\__init__.py", line 1699, in __call__
return self.func(*args)
TypeError: save() missing 1 required positional argument: 'ent'
THen
def create_window():
root = Tk()
root.title("Write your Note")
ent = Entry(root, width=100).pack(side=TOP, padx=100, pady=100)
def save(ent):
ent.get()
print(ent.get())
b = Button(root, height=1, width=10, text="save",command=save)
b.pack(side=LEFT, padx=2, pady=2)
root.mainloop
ok thats a bad idea
ent is a already defined variable name
dont use it as an args name
what should i use
not ent
Like text
for example
when i was writing tkinter i used to go with e1 e2 e3 or entry1 entry2 entry3 if i had a bigger amount of input fields i didnt really want to give good names to
so ent1 would work
e1 would be best
All it says now is ```
TypeError: save() missing 1 required positional argument: 'e1'
oh
of course it does (sry missed that)
a button function doesnt get any event
its always a click when its triggered so no event
aka
dont have any args at all
and also
if you want to access the content of your entry widget
use ent again
sorry for not seeing that
def create_window():
root = Tk()
root.title("Write your Note")
ent = Entry(root, width=100).pack(side=TOP, padx=100, pady=100)
def save():
print(ent.get())
b = Button(root, height=1, width=10, text="save",command=save)
b.pack(side=LEFT, padx=2, pady=2)
root.mainloop()
this should work
Yes
File "C:\Users\Talkcom Inc\AppData\Local\Programs\Python\Python36\Lib\tkinter_init_.py", line 1699, in call
return self.func(*args)
File "C:/Users/Talkcom Inc/PycharmProjects/Randomizer/venv/Lib/RANDOMIZER.py", line 14, in save
print(ent.get())
AttributeError: 'NoneType' object has no attribute 'get'
hmmm
oh and
no * imports you shouldnt do that poluting global namespace
ooh
you do pack in same line
import tkinter
from tkinter import *
change
ent = Entry(root, width=100).pack(side=TOP, padx=100, pady=100)
to
ent = Entry(root, width=100)
ent.pack(side=TOP, padx=100, pady=100)
thats your code?
import tkinter #AND
from tkinter import *
Ye
that doesnt make sense
Y'
use import tkinter OR from tkinter import *
*Facepalm