#user-interfaces
1 messages · Page 56 of 1
Use a signal
how do i develop with kivy on PC for an android app?
@inner nest That not the way I want to do it
I trying to have 2 files work together in Tkinter, One FILE has one WINDOW and the other file has another window.
I don't want to have two windows at the same time
I want to have two files that work together and both contain two different windows
If anyone can help pls tell me how to do the code
thx
I got a notif for an @ but the @ is gone now
???
Anyone here have any recommendations on what package to use when trying to implement a live spellchecker inside of a text box?
my listWidget activated signal isnt working at the begining when it is made and I need to select an item in it to activate the signal...
How can I solve that so there is no need to select an item to activate the signal?
@azure vault First you develop the kivy gui on your desktop like a classic gui. Next, you package the gui for android. You can have more informations about packaging in the kivy doc > https://kivy.org/doc/stable/guide/packaging.html
@silk basin TextBlob and PyEnchant seems to be good libraries. You can found examples online
No, not really.
@past locust you can pass multiple arguments to lambda as well
hey, anyone here familiar with the internal of click (the CLI library) ? I'm trying to call a command from already validated/converted Parameter but getting lost in the source ... (also lmk if this is the wrong chan, i'm new here)
@rich wigeon it is not the wrong channel
can you explain what's the issue exactly? are you getting any error?
nope, no error and my think works as is, but it's too hacky for my taste, let me explain
my goal is to generate web UIs (and later GUIs) from click command definitions
i use the Command / Argument definition to generate HTML forms qnd validating them, and end up with a bunch of already validated/coponverted values for the parameters
now i want to feed those values into the command callback
but the oonly method i found is to turn the options/values into an array of string and feeding that to the parser
ok so you already made the command but need to add parameters to it?
so the whole conversion part happens twice
you could add flags to your command
yeah, the command has all the options defined and works as intended on the command line
you used click.option right?
yep
option and argument
the core of the issue here is that instead of getting the options from the command line, I get them from a web form
oh..
for k, v in form.data.items():
par = parameters.get(k)
if isinstance(parameters.get(k), Option):
if par.is_flag and v:
raw_options.append(par.opts[0])
elif not par.is_flag:
raw_options.extend((parameters[k].opts[0], v))
elif isinstance(par, Argument):
if len(v):
raw_parameters.append(v)
args = raw_options + raw_parameters
debug += f"args={args}"
old_stdout = sys.stdout
old_stderr = sys.stderr
sys.stdout = output_buffer = StringIO()
sys.stderr = output_buffer
try:
output = command.main(args=args, standalone_mode=False)
except UsageError as e:
error = e.format_message()
sys.stdout = old_stdout
sys.stderr = old_stderr
output = output_buffer.getvalue()
the user has to input the command on the web page instead of the command line?
yep
then the form validates and converts the values using the option types defined in click
so in this code example, form.data has those values, and they've already been through the validation/conversion grinder
and is it working as expected?
yeah
it's just inelegant
to have to convert the options back into their raw form and have them be parsed again
the relevant part of the code above is output = command.main(args=args, standalone_mode=False)
where args is a list of raw options/args
couldn't find any lower level of hooking into click
Hi
I'm not sure if is it the right place to post this problem
I'm developing a python launcher (for .py) just like the default one
but the thing is it runs the scripts with PyPy implementation instead of CPython.
I'm trying to add a shortcut of my program to windows context menu
and i did with windows registry
but i want to add it in Open with
here
as you can see in the main context menu
there is a shortcut to my program "Run with PyPy"
But i want to do sth that Windows recognize it as a .py file opener
Thanks in advance.
Is PyPy flagged as capable of handling .py files? Idk the inner workings of windows but I believe it just looks for apps capable of handling the file type in question
Theres a window in the settings to set all the defaults for different file types
if this doesnt solve your problem, I assume it should at least set you on the right path
Hello, how/what module would i use to get python to insert a query into a search bar like this?
Hi I am having a weird problem and I am not really sure how to go about fixing it. I have two functions I have been trying to try and find a bottleneck my data collection and my live plotting of the data. data collection takes about 2 seconds per cycle and the plotting takes about 0.2 sec per cycle both of these speeds are acceptable. however the issue seems to be when a live plot is open the data collection slows down to between 4-14 seconds per cycle which is way two slow. Ideal time for data collection would be 1 second per cycle. i can post some relevant code but i cant figure out how to go about fixing this
the data collection is on its own thread btw
@limber crown Tkinter would be the best
@limber crown Yes, if that's a website. You can use Selenium to automate that task.
@limber crown If it's a desktop app you can use PyAutoGUI. But from the looks of it looks like a website.
If they are in the same directory you can just use import
It’s where it is saved on your computer
K
it did not work
@safe moon
I try that 5 to 6 times
it did not work
put it in different folder
made a new file
nothing
worked
So you have file1 and file2 in the same save folder on your computer
yes
Then inside of file1 you should be able to do “import file2”
yes
From there you should be able to use stuff from file2 inside of file one
Is it giving an error when you try and use a method from the second file?
will how
Can you send a sample of the code where you are having the issue?
I’m not to sure about tkinter since I mainly use pyqt5 but if I had to make a guess I would think it’s you need a different pass your window differently
how do I do that
With tk I’m not to sure
@uncut pawn your importing the same file in the same file?
thats most likely your error
i think what you want is, to write that line import mymodule2 as m2 in your mainmodule.py
and then it should work unless there is some other issue
you should always import the file you want to import in another file
not the same file itself
help
help
until i know someone is gonna help me im not gonna say anythign
@fickle rivet
PLEASE
IM NOT GOING TO SLEEP UNTIL I FIX THIS ISSUE
@grim onyx
im trying to make a box you can type in
it dosent work
ive been up for hours
i just want to go to sleep
u want to create a text box right
yes
In this tutorial, I’ll show you how to create an entry box using tkinter. I'll use an example to demonstrate this concept in Python.
try this
WOW
might help
bruh
i might be able to solve the error
but its gonna take a lot of time
and i dont think id be able to explain in text
if it dosent help
then ill try to solve it @robust willow
Check if it is of any use
Fuck THANK YOU @nimble stratus I CAN SLEEP
really?
Does anybody have any experience with creating a GUI for discord bot?
Ask in general
not in #user-interfaces? 😆
Nah ask someone there so they can help u here
ppl arent active here
@digital rose
@sinful sphinx this is not a server to send unsolicited advertisements.
can anyone help me with something in tkinter?
When i build a kivy app with buildozer buildozer -v android debug , where does it get the dependencies from ?
@marsh perch ask your question
i have a list with messages which i want to show in a label. after pressing a button it has to show the next message in the label but i cant seem to figure out how
@lost tangle You can configure a buildozer.spec, maybe you can find informations here : https://raw.githubusercontent.com/kivy/buildozer/master/buildozer/default.spec
@lost tangle You can configure a buildozer.spec, maybe you can find informations here : https://raw.githubusercontent.com/kivy/buildozer/master/buildozer/default.spec
@inner nest I mean , does it download the dependencies when i build the apk ?
I don't know, I found this in the buildozer github https://github.com/kivy/buildozer > "For Android, buildozer will automatically download and prepare the build dependencies. For more information, see Android-SDK-NDK-Information. Note that only Python 3 is supported."
I don't know, I found this in the buildozer github https://github.com/kivy/buildozer > "For Android, buildozer will automatically download and prepare the build dependencies. For more information, see Android-SDK-NDK-Information. Note that only Python 3 is supported."
@inner nest In that case, how would i add a pip package that i downloaded from github (cloned and installed) in the dependencies
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'``` I get this error while building apk in buildozer
it seems buildozer.spec file is your friend ^^
https://buildozer.readthedocs.io/en/latest/specifications.html
"requirements: List, Python modules or extensions that your application requires.
The requirements can be either a name of a recipe in the Python-for-android project, or a pure-Python package. For example, if your application requires Kivy and requests, you need to write:
requirements = kivy,requests
If your application tries to install a Python extension (ie, a Python package that requires compilation), and the extension doesn’t have a recipe associated to Python-for-android, it will not work. We explicitly disable the compilation here. If you want to make it work, contribute to the Python-for-android project by creating a recipe. See Contribute."
or maybe its your python path ?
perhaps it will be helpful : https://stackoverflow.com/questions/38132755/importerror-no-module-named-encodings
I recently reinstalled ubuntu and did upgrade to 16.04 and cannot use python:
$ python manage.py runserver
Could not find platform independent libraries <prefix>
Could not find platform depe...
Thank you..
is there any way I can add a Frame to tkinter.Text
since Im using tkinter.ttk.Notebook and I need to insert text
in tkinter, is it possible to make it so when the user puts some text in an entry the entry doesnt display the text, but instead some ***? kinda like what google does when you put in passwords
@digital rose widget = Entry(parent, show="*", width=15)
thanks!
say i am using pycharm in debug and my script throws an error. I still have access to the running program to input commands, but it will no longer run automatically without some sophisticated bypass. Is there a way to continue after an exception in pycharm?
@oblique nova your question is not really related to user-interfaces, I think you might ask your question in #tools-and-devops channel
@inner nest Thank you I will do that
(I see now, this channel is about building gui with python, not using a gui for python lol)
in tkinter is there a way to display the ui in fullscreen
ok 1 min i'lll try that
but when i do that it is going to complete fullscreen wherein the close button is missing and i cant see the taskbar beneath...it has completely gone to fullscreen......it has filled the whole computer screen....
ow
is there a solution for that ??
you can get the resolution directly by the os
how to do that
or
import tkinter as tk
root = tk.Tk()
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
follow this : https://stackoverflow.com/questions/3949844/how-to-get-the-screen-size-in-tkinter/3949983#3949983
should i give any value inside the screenwidth and screenheight
I think winfo_screenwidth() return the width value
import tkinter as tk
root = tk.Tk()
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
@inner nest when i do this i am getting a tiny window
with root.setGeometry(screen_width, screen_height) ?
you can try to use this package if you are stuck : https://github.com/rr-/screeninfo
Hi
I want to build a simple GUI for my automation script, being able to choose a few options (including date). Which GUI framework is recommended?
in python?
yes
I heard about Tkinter but haven't used it yet, am wondering if I should use that or something else like Qt
I heard about Tkinter but haven't used it yet, am wondering if I should use that or something else like Qt
@proper grove Yeah It's cool to make applications
do you want a simple example?
from tkinter import *
root = Tk()
Label(root, text="Hello World :D").pack()
root.mainloop()
Run this out
I will thanks
you're welcome
Cool
👍
OK I'll play around with Tkinter a bit and see if I can make it work
So you're not storing anything, because you're saving the output of the .grid() function, which doesn't return a value
You want to split up the initialization of a widget and the placement of a widget
I'm not entirely certain what you mean by "copy of a task for the button" either.
You want to save the task in a button before the task is pressed?
So your buttons are created from a for loop and associated with some task function. The problem is that when you press the button it isn't starting the task function but is... printing the string?
If you overwrite the string on the button, unless you store the original string elsewhere, you can't get it back.
You don't overwrite the original string or you hold the original string in a temp value that you can reference when you want it back.
Well I'm not really understanding the use case where you'd have to overwrite the string the button is associated with
what exactly are you aiming to store in that odd globals()["task_state_" + str(task_count)] Because right now you're not storing anything.
but are you actually trying to store the button you create there? Are you planning on using it later?
There really isn't a solution with your current implementation. Once you overwrite the text associated with the button, unless you're storing the original text elsewhere that you can reference, there isn't a way to get it back
So, this is the part of your code that's actually creating and placing the button:
Button(text=task, command=lambda: press_button(task)).grid(row=task_count, column=3)
This part, is currently doing nothing but storing a NoneType value: globals()["task_button_" + str(task_count)]
So I'm not sure what you mean when you say "give it the same name". Multiple buttons can have the same label and still be distinct objects in memory.
What's wrong with this topical channel?
oh, you mean voice help. I'm currently watching a lecture, so I won't be able to chat right now
why can't the button have a label of "task" and not the name of the task itself?
the text on the button itself.
But you said you're having trouble with the text on the button changing/not changing
Oh, you're saying it's using the last task in the for loop, not the one assigned at creation
instead of comannd=lambda:dasdfasdf use command=partial(press_button, task)
lambdas only resolve references when they're started (i.e. when you press them). Partials will "freeze" the reference when you initialize them
at the top of your file from functools import partial
Sorry it took a bit for me realize what was happening
glad it works now
Hey guys, not sure if this is the right place to ask for help, but here it goes: I want to make a small "app" to read data from a database. That I know how to do, but my problem is that I want to show it on a graphic, anyone free to help me?
A graphic to show the data (inside the user interface)
Is it possible to build a UI pyqt5 without downloading the designer
Can I just code it like tkinter
Cuz I think the pyqt5 requires subscription?
Idk
in tkinter how do I make the window be maximized
@distant sand pyqt5 doesn't require a subscription. But you can absolutely build UIs without that program. I personally don't like to use Designer
Can someone help meeee
where is the grid?
Hey @digital rose!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
so what is the program U R trying to make
so I can help U Better
yes please
uh
!codeblock
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
Ik
let me run the program quick
that bug isnt in Your code
its tkinter
but if you want to see my code
so U can see it and learn from it
mhhhhh
yes
or do U want me to paste the code
its a little long
ok
!codeblock
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
uh it says its over 2000 characters
yes
here copy and paste the code from here
did U take a look
Your welcome does it look nice
its my second week in GUI so I'm open to suggestion's
whats that?
weird
?
it ran on mine and on my family member computers
oh thx
ok
thx
I DMed
it has customization features
yes
thx
of course
😆 first not family member that ran my code
yesterday I made a piano tiles bot
if U need help in learning Tkinter im good at it
Just DM me
im currently working on a MS paint clone
as a fun project
yeah me too
😃
so far U can draw and erase the buttons and draw over the button LOL!
ok thx
cya
yeah
👋
Hello guys,
I just started using PyQT5 and I've been doing some JavaFX before so I have some knowledge about GUI programming. I'm using PyQT5 and QT Designer to make my application. I just wonder (what I can't seem to find an answer on google of) how to work with different scenes?
I have created a MainWindow and been able to use that buttons there to preform some action, but how do I create another scene and put other elements there?
QStackedWidget
hello
I want to make a gui like this
There should be an image on the left and a frame on the right
the frame should contain a few text labels
the whole window should also be resizable
how can I go about this? Please help me I use tkinter thanks
class WelcomeScreen(Modal):
def __init__(self, master, loop: asyncio.get_event_loop, event: asyncio.Event):
super().__init__(master, loop, event)
self.WelcomeImage = ImageTk.PhotoImage(Image.open("data/images/stock_welcome_image.jpg"))
self.WelcomeImageLabel = Label(self.master, image=self.WelcomeImage, width=800, height=800)
self.AccessFrame = Frame(self.master, pady=20, padx=50, border=50)
self.signup_modal = SignUpModal(self.AccessFrame, self.loop, self.event)
def show_modal(self):
self.WelcomeImageLabel.grid(column=0, row=0)
self.AccessFrame.grid(column=1, row=0)
self.signup_modal.show_modal()```
this is what Ive comeup with now
this is what I have now
But it isnt scalable
I need the frame on the right also to be scalable
how to do this? Please help me
thanks!
@fallen rain A solution might be to pack() two frames side by side. One with your image and a second with your entries in a grid. Because pack() method resize elements dynamically while grid is more tricky to configure.
Okay
this is the actual image
but in the gui its zoomed
I dont want that
it affects the clarity
How to fix that?
What type of widget are you using ? @fallen rain
did you try in a label or in a canvas ?
you can resize your image with ImageTk object
@deep hornet you can start with smalls projects like print meteo for a city given by the user
@digital rose grid_forget() all widgets that you know are in row 2; they may be retrievable by other means as well, hold on
Alright, technically you could winfo_children() the parent and then call an empty grid_configure on each of the returned children to test whether they are in row 2, but instead of doing that I recommend keeping track of your widgets at python level
yes
okay 
what's you're problem?
i am learning tkitner for gui as my first module
@deep hornet ah welcome
umm what @digital rose
Do you want example?
no
okay 👍
just want to ask if u have anything like suggestions
i am starting to learn
ah sorry
what
i just want suggestions as to what to leanr before
and where to learn it from @digital rose
ah I understand it now
lol
so just leave it
i thought this was a help channel
yeah it's help channel @deep hornet
oh
👍
Umm I had a question but I see is not the right place to that?
Good afternoon everyone by the way
Ah well I think it is?
Lol
Ok so I'm gonna make my question, please forgive me if is not the right place. I am building an instagram bot with Tkinter. The thing is that when I have an Entry when I click the botón for that entry I save the value in a list and I show the list in the screen. But when I click that botón the entry and the text label just get wild and we can not see the text anymore. I have to resize the screen and it works
Any idea why?
I just got it!
Thank you
really cool
Guys
If you want
to fix this buttons
or How to convert this Buttons
into this Buttons
it's easy
Who want the method ?
I just got it!
@digital rose Cool
I have one question how do you make a user interface using python? would you like use tkinter or PyQt? just tag me for if you answer so that i know.
@celest jewel yes someone would use PyQt5 or PySide2, Tkinter, Gtk
Tkinter is better
@remote ravine I have never heard of PySide2 and Gtk. Are those like modules in python?
@digital rose ok
@digital rose if ur gonna say something at least say something right
@celest jewel PySide2 and PyQt5 are almost the same.. let me send u a link
@digital rose if ur gonna say something at least say something right
what??
@remote ravine also what do you recommend I use?
spork
Also i am still a beginner
@celest jewel https://www.learnpyqt.com/blog/pyqt5-vs-pyside2/
to give u more info
ok thank u
also i use PyQt5 currently BUT u use whatever is better for you
Ok
oh... well i basically have no knowledge about that
tbh idk if qt ever supports macs
ok
go with tkinter in this case
Trying to use this line of code every tkinter tutorial on youtube uses
not sure why its doing this
Even the docs mention this
???
It's not an error, it's just VS Code and its linter complaining
guys
So I have this
and this
notice the huge space below the login tab?
Its ugly
how can I fix it?
class WelcomeScreen:
def __init__(self, master, loop: asyncio.get_event_loop, event: asyncio.Event):
self.master = master
self.loop = loop
self.event = event
self.WelcomeImage = ImageTk.PhotoImage(Image.open("data/images/stock_welcome_image.jpg"))
self.WelcomeImageLabel = Label(self.master, image=self.WelcomeImage, width=800, height=800)
self.AccessFrame = Frame(self.master, pady=20, padx=50, border=50)
self.TabControl = ttk.Notebook(self.AccessFrame)
self.LoginTab = ttk.Frame(self.TabControl)
self.SignUpTab = ttk.Frame(self.TabControl)
self.TabControl.add(self.LoginTab, text='Log In')
self.TabControl.add(self.SignUpTab, text='Sign In')
self.signup_modal = SignUpModal(self.SignUpTab, self.loop, self.event)
self.login_modal = LoginModal(self.LoginTab, self.loop, self.event)
def show_modal(self):
self.WelcomeImageLabel.grid(column=0, row=0)
self.AccessFrame.grid(column=1, row=0)
self.signup_modal.show_modal()
self.login_modal.show_modal()
self.TabControl.pack(expand=1, fill="both")```
this is how I've defined it
It's not an error, it's just VS Code and its linter complaining
@plain elk what do i do then
how can I fix it?
@fallen rain Like I want both the content of both the tabs to be in the center
that will be nice
thanks!
Is it possible to create nice modern looking UIs with tkinter
hmm okay thank you
Hey, does anyone know how to create a Hamburger menu like this in pyqt?
@plush stream I just wanted to say I love your wallpaper :D
@finite junco thanks, you can download it for free here https://pin.it/2Q7dxZN
thanks <3
@plush stream wdym hamburger menu?
That three horizontal stripes menu
No, im talking about that three blue stripes in the left upper side of the gui
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
how do you set a default extension```python
inputName = asksaveasfilename(defaultextension='#.txt')
filedialog.asksaveasfilename(initialdir="/", initialfile="results", title="Save",defaultextension=".xlsx")
or
(defaultextension='.json', filetypes=[("json files", '*.json')])
@lethal cipher
thx
and
I mean if you have 3.9 installed and 3.7 how do U write a python script in only 3.7
https://hasteb.in/oyocupuw.rb can i get a review on this app?
@lethal cipher use a virtual environnement >> https://realpython.com/intro-to-pyenv/
!codeblock
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
why doesnt it work```python
def saveText(event=None):
global fileName
if not fileName :
inputName = asksaveasfile(mode='w', title="Save the file", defaultextension=".txt", filetypes = (("Python","*.py"),("Text File","*.txt"),("all files","*.*")))
else:
inputName = fileName
if inputName:
fileName = inputName
content = textField.get(1.0, END)
with open(fileName, "a") as theFile:
theFile.write(content)
root.title('{}'.format(os.path.basename(fileName)))
why destroy not work when write place? pack work bug in tkinter ?
is there some way to fix up the resolution on tkitner windows?
which library would you reccommend for a GUI with card-like functionalities?
<PySide2.QtWidgets.QPushButton(0x146f570, name="button_lesson_12") at 0x7f88afeb8400>
is there way I can access that name='button_lesson_12' ?
I running these buttons through a for loop and when i type button.name() I cannot get that
EDIT: SOLVED
button.objectName() does the trick
how do I make an if-statement to check if something is in a file name? Like:
if 'data' in file.name:
@digital rose yeah what you have is correct
are you sure?
Need some help with this code.
Pastebin.pl is a website where you can store code/text online for a set period of time and share to anybody on earth
The loop goes to 12 all the time and doesnt stop at the correct one
am I missing a line ?
@digital rose yeah what you have is correct
@teal hearth I am going to use it withopen("file_name.txt", "a"), tho
so should I use if 'something' in open("file.txt", "r")?
I am going to append to the file, tho
ik
so you want to add to the filename ?
no
i want to add to the content inside it
so I am using an if statement for getting which file to append to
should I use this?
file_name=open("file.txt", "a") if 'data' in file_name: file_name.write("text")
is there an official page for files on the docs?
in tkinter, is it possible to add a entry for photos?
@digital rose youve already opened the file. so only thing remaining is to write to it. maybe what you need is a list of filenames and then if file name is == what you want , open it and write to it
Someone knows how to use Pysimplegui... Cuz when I convert .py to exe and close the application it still running in background... I'm trying to put one break, but the break stop the hole code in the wrong moment?
In tkinter can we add an image in a background
I would like to have the pyautogui left click drag a V shape without it letting go of the "click" halfway through, is there anyway to do so?
import pyautogui
import time
time.sleep(2)
pyautogui.moveTo(905, 336)
pyautogui.dragTo(984, 306, duration=0.5, button='left')
pyautogui.dragTo(1046, 336, duration=0.5, button='left')
in tkinter, when i make a label, and then pack it, i can't select it with my mouse
i want to do that beacause i wan to ctrl c, ctrl v
how do i make the label "selectable"
?
make a button because that is the only one that is selectable.........i think label's arent selectable.......thats what i think........
@deep hornet get the width and height of the gui, and set the button width to half that minus a bit, etc
use .place()
ok
get the width of the entire window
and set the buttons position to half that
same for height
because half of the width would be the middle
here is the code
ok
@deep hornet what is your problem?
how to move this button to the middle
@deep hornet Easy
use the place system
example:
from tkinter import *
root = Tk()
my_Button = (root,text="Button Click Me")
my_Button.place(x = 10, #You're X-Axis Position
y = 20) #You're Y-Axis Position
root.mainloop()
you're welcome
hey guy's i have create a GUI for Mb to Gb convert using python
hi guys,
Today's we are going to code make an application which helps PC users for making harddrive partition
follow me on GitHub: https://github.com/SwaroopOfficiel
try and share with me :
@Swaroopofficiel on Twitter and Instagram
happy coding
thanks and subscribe to my channel
yeah I will
any idea why this is happening
it worked on my old pc
my new one seems to have this happen to it
when i do cd Videos
or cd documents
it works
any idea why this is happening
@random kelp Easy
you mean with python pip ? or?
If it's with PIP
reinstall python
and make sure "Add to Path" it's true
@digital rose I mean, just changing directories
@digital rose I mean, just changing directories
@random kelp ah make sure the directory is true
@random kelp I mean the directory of you'r py file
@digital rose thing is Im just tyring to get into the desktop
and for some reason its not working
@digital rose any idea on how to fix it?
@digital rose any idea on how to fix it?
@random kelp Look I have the same
maybe we don't make the d captin
?
how did u fix it?
@digital rose
I not sure how to fix it sorry
Hi
@random kelp This is a bit late, but you can view the directories you're able to travel to with the command dir
import time
import cv2
import smtplib
Load the cascade
sender_email = "dhruvkkothari@gmail.com"
rec_email = "kapilkkothari@gmail.com"
password = open("scratch.txt", "r")
passwords = password.read()
face_cascade = cv2.CascadeClassifier('haarscadesfrontface.xml')
Read the input image
cap = cv2.VideoCapture(0)
FaceDetected = False
To capture video from webcam.
while True:
_, img = cap.read()
# Convert into grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
Detect faces
faces = face_cascade.detectMultiScale(gray, 1.3, 4)
cv2.imshow('img', img)
Draw rectangle around the faces
for (x, y, w, h) in faces:
cv2.rectangle(img, (x, y), (x+w, y+h), (255, 52, 50), 10)
FaceDetected = True
Display the output
if(FaceDetected == True):
for i in range(1):
message = "There is a guy outside your door."
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(sender_email, passwords)
print("Login success")
server.sendmail(sender_email, rec_email, message)
print("Email has been sent to ", rec_email)
time.sleep(10)
if(FaceDetected == True):
messager = "There is still a guy outside your door."
server.login(sender_email, passwords)
print("Login success")
server.sendmail(sender_email, rec_email, messager)
print("Email has been sent to ", rec_email)
break
if(FaceDetected == False):
print("bye")
k = cv2.waitKey(30) & 0xff
if k==27:
break
cap.release()
Why isn't my code working?
In tkinter can we add an image in a background
@left lava yes
How i can use a fluent design in tkinter.
What do u mean a fluent design?? @steady coyote
thats an oxymoron i think
Its a custom ui. You won't have any default functions for making this kind of ui. You'll have to create different custom functions to be able to create this kind of ui. @steady coyote
@modern marsh can you share the code to do that?
@past locust thx
there maybe a better method
but the way i did it was
using pillow library create a variable like image that contains the image
then,
label.pack()
@left lava
maybe frames can do this too
@modern marsh cool I’ll try
Nvm i was tryna give an example to @steady coyote
ahh ok
The code is too long
how to create that sort of ui?
with the transparency etc
ig its very hard to do that in tkinter
The second example
On the website
ahh there is another method similar to that
make the relief flat, put a round image in, make the bg same as the bg of the window
easy round buttons
@steady coyote its like insanely hard to do in tkinter, Use Qt if you want some advanced effects
Ok. I see
And the most important of all, u shouldn't be doing UIs in python in the very first place. JavaScript has neater UI options, if u want to make a bigger project tbh. @steady coyote
if youre on a mac, you could manipulate the objc libs to write UIs
but that belongs in #esoteric-python lol
how do i make the text in a label selectable?
u mean a flat button with no boundaries?
i think they mean copiable.
I've only really ever used GUIZero for making graphical interfaces in python and I've had a look around and like the look of PyQt/PySide2.
I've seen that there are licencing issues with them and was wondering which one is "safer" to use, I'm not bothered by the slight differences in their functionality.
Pyside 2 has more flexible licensing
would PyGObject, wxPython, or PySide2 (considering licenses and gui quality on all OSes) be better for an open-source, free to download BUT publicly available app?
if you compress your code into a .exe, no one will know you used guizero ( ͡° ͜ʖ ͡°)
@fluid tinsel considering quality Pyside2 easily outranks all the others
but it is more difficult to learn
and for licenses it would be better if you searched it up according to your specific project and situation
thot pyside2 should be fine for the usage you stated
it’s just an open-source public syntax highlighter for something
i used to use PyQt so I can remember some things.
oh I just saw the requirements are:
>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.10
which basically means it only runs on python 2.7 to python 3.0. i’m using python 3.8 rn
so due to that, remove it from the options, PyGObject or wxPython?
3.5 to 3.9 would be fine there
installation fails.
it shouldn't?
something is wrong at your end then
cause i am using python 3.8.3 and its working just fine
Hey guys I'm trying to learn tkinter and I'm trying to display an image but only a part of the image comes up on the screen
Can anyone help me resize the image?
@vale flint change the pixel values in line no: 10 ...
im not sure y, but the output doesnt change when i change the values
@vale flint well you use place to resize the height and width rather than using pack
@vale flint well you use place to resize the height and width rather than using pack
@digital rose oh, can you please type out the syntax of that, I'm kinda confused how to do
@vale flint use this https://www.tutorialspoint.com/python/tk_place.htm
Python - Tkinter place() Method - This geometry manager organizes widgets by placing them in a specific position in the parent widget.
from tkinter import *
from PIL import ImageTk, Image
window = Tk()
window.title("My program")
image = ImageTk.PhotoImage(Image.open('images/spidermanfalling.jpg'))
my_img = Label(window,image=image,width=200)
my_img.place(height=200)
window.mainloop()
example
can someone dm me cuz i need a lotta help for a project.
All help is appreciated
@eternal apex you can post your problem here.
@deep hornet nice job!!! bask in the glory of success aha
thx
i am really proud of my first tk prgram
https://github.com/Yuvarajkatyal/tk-calculater here is the code\
@digital rose
@eternal apex here
contact @digital rose he might be able to help u
ok
gut
@vale flint use this https://www.tutorialspoint.com/python/tk_place.htm
@digital rose
thanks a lot dude, this helped and another tutorial i found today morning 😄
ok
thx
lmao thanks for noticing
😂 You're welcome
Could this be the right place to find someone that is looking for a project to move a solution from TKinter to be a FLASK application ?
@sly harbor #web-development might be a better option, but we can certainly try to help
How can I handle user interaction that triggers long-running requests without causing the UI to freeze up?
By using threads
Know any good code examples for that in a UI framework context like TKinter or pyQT? Or would that be a better question for #async-and-concurrency ?
@obsidian grotto i have examples of it in both tkinter and pyqt. I need to pull the code from a laptop though. Give me ~20 minutes?
@static cove yes, thank you! 🙂 🙂
@maiden mauve are you getting a specific error?
@maiden mauve What's the error when you hover over that red-underlined curses?
I ask you and repeat a question @obsidian grotto @static cove
It's unclear what error you're getting from your code, so we're asking for more information
The error is that there is no error without any reason showing this defect to me@static cove
Does something appear when you hover over it?
At the top bar, can you click "View" and then "Output"
A bottom panel should appear. I then want you to navigate over to "Problems" in that bottom panel
@maiden mauve what python version are you on?
3.8.6
So that's a pylint warning. In my experience pylint doesn't do a great job with dealing with library import errors. I would recommend switching the linter to flake8
Weird that pylint gives it red squiggly instead of yellow though on VSCode.
This is an issue specifically with pylint not being able to analyze C source doe by default and curses is a C extension technically
@maiden mauve just try running it, does it run?
what should I do now? No, keep learning Python or what?
@static cove
Well, it's not a true error, so just keep on trucking. If it's bothering you, you can add --extension-pkg-whitelist=curses to your pylint config file
I do not understand you, I am new to Python@static cove
@maiden mauve use Python to run the file from the command line! Keep going!
@maiden mauve is this your first python program?
@maiden mauve That red squiggly is a lie, a fake error, ignore it. Keep writing the program the way the tutorial shows you.
im using tkinter and i want to know how big (width and height) should my window icon be?
@safe void According to this thing I just googled, tkinter's iconbitmap method supports .ico files: https://subscription.packtpub.com/book/web_development/9781788622301/1/ch01lvl1sec21/setting-the-main-window-s-icon-title-and-size
The Tk instance differs from normal widgets in the way that it is configured, so we will explore some basic methods that allow us to customize how it is
But there's also an iconphoto method? https://www.geeksforgeeks.org/iconphoto-method-in-tkinter-python/
If you want to go the iconbitmap route with an .ico file, those are 16x16 or 32x32.
I'd use Imagemagick to convert to that from your source image:
$ tldr magick
Local data is older than two weeks, use --update to update it.
magick
Create, edit, compose, or convert bitmap images.
ImageMagick version 7+. See `convert` for versions 6 and below.
More information: <https://imagemagick.org/>.
- Convert file type:
magick image.png image.jpg
- Resize an image, making a new copy:
magick convert -resize 100x100 image.jpg image.jpg
- Create a GIF using images:
magick *.jpg images.gif
- Create checkerboard pattern:
magick -size 640x480 pattern:checkerboard checkerboard.png
- Convert images to individual PDF pages:
magick *.jpg +adjoin page-%d.pdf
But I'm sure @static cove has a more well-informed opinion than I do :3
Alright, sorry for the large code block incoming. Spinkyt, this is a rough overview of how I structure my pyqt threaded code (I highly recommend pyqt, it's implementation includes thread safe classes)
class WorkerSignals(QObject):
new_data = pyqtSignal()
class Worker(QRunnable):
def __init__(self, *args, **kwargs):
super(Worker, self).__init__()
self.args = args
self.kwargs = kwargs
self.signals = WorkerSignals()
@pyqtSlot()
def monitorDataThread(self, *args, **kwargs):
print("Do the thing you want to do in a thread")
print("I found data")
self.signals.new_data.emit()
class myMainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super(myMainWindow, self).__init__(parent, *args, **kwargs)
self.threadpool = QThreadPool()
def monitor_data():
self.monitor_data_worker = Worker()
self.monitor_data_worker.new_data.connect(self.other_function)
self.threadpool.start(self.monitor_data_worker.monitorDataThread)
So, in my use case, I use global variables to help lock/unlock long running threads. I don't care about having to stop threads early, so I use QRunnables. If you want to use QThreads, I have examples somewhere in this channel for how to implement that instead. (I'll go find it and link it).
This should be plenty to get me going, many thanks! @static cove 😁 🍻
Overall, you have a class that's usually called "Worker". This is where the threaded functions actually occur. You can transmit data and progress back via signals. If you need an example of how to transmit data back through a signal let me know.
I read a tutorial on signals and slots a couple weeks ago, but I think I should go give myself a refresher.
There are some other considerations with QRunnables. For instance, if you don't start a QRunnable within a certain time frame it gets deleted. I spawn and start mine back-to-back so that's not an issue for me.
Events and signals in PyQt5 demonstrates the
usage of events and signals. The examples connect a signal to a slot, reimplement
an event handler, and emit a custom signal.
Signals and slots are great! My favorite feature of pyqt
If you want to go the iconbitmap route with an .ico file, those are 16x16 or 32x32.
@obsidian grotto ty!
@safe void yw
@safe void definitely recommend the .ico route! It makes it easy to use
yup im doing that
You can also go the threaded route with tkinter but it's such a headache if you don't get it right
It's also much more annoying to share data between threads
@static cove Yeah, that was my initial impression of tkinter. It's just something Python threw in because they like having a fat standard library, but I couldn't find any decently complex apps made with it. QT definitely seems to be the talk of the town in the Python community for cross-platform GUI dev.
And good to know about PyQT vs. PySide, that there's actually a technical advantage putting aside the philosophical debate.
I think they're equivalent right now (I think there are a handful of small difference technically). I use pyqt5 out of sheer laziness.
yes
I had a couple less problems with pyqt5 but beyond some differences like signals it's mostly the same. Neither seem to be in active development except for Qt version updates
Pretty sure Pyside 2 has been adopted officially for python Qt under the Qt company so it should be more actively developed
There is no "main.jpg" file inside that folder, so it can't find the file
Hi
I have bad internet so I can't see any thing
in the image
@deep hornet
Are you want to open the relative path
?
from PIL import ImageTk
load = Image.open("C:\\Users\Shihab\Desktop\ZO Image Editor\File_Icon.png")
render = ImageTk.PhotoImage(load)
this is the abs path
ok so i want to make a calculator with tkinter. so what im thinking is that the user presses a button that adds a string with the digit/operation to the end of a list, and then i use "".join(list) and then it will be like "1+1" and then i use eval() on that string, and then i use the set() method on the StringVar i created earlier. Is there an easier way to do this?
Hi
hi
you mean make calculator with tkinter
then
yes
yeah and you want easier method
hmmm
if it is posible
are you made entry
no
with buttons
ah
make a func
cuz like then the user has to know python syntax and knows that to use "to the power of" u have to type **
and i want to add factorial and i dont want the user to type math.factorial()
from tkinter import *
def plus(numbers):
bla bla ....
Button(text="1",command = lambda: plus(1)).pack()
wut is lambda
lambda is make you can access to the var in functions
ohhhhhhh
and i wondered how do i use the function in the command parameter with parathases cuz i need to enter parameter without activating it
yeah
the lambda is cool
and i want to add factorial and i dont want the user to type math.factorial()
@digital rose so I'm really bad inmathmodule
factorial is like:
5 factorial is: 5 * 4 * 3 * 2 * 1
which is 120
ah
also
how can i stop tkinter from using that "e" that google uses when the number is too large
i want to display whole number
no "e"'s allowed
ah you mean
the intreger num?
what is intreger
integer?
yes
ah
it's easy
the round
will be cool
ok
num_1 = 444
num_2 = 33
print(round(num_1 + num_2))
output:
477
how can i tell tkinter to go on the next line if the label is too large to fit on the same line
hmmm
easy the if stament
look
from tkinter import *
test = Label(text="large text ............................").pack()
if test.width > 200:
print("the Label is bigger than the sreen")
else:
print("The label is cool")
why 200?
any number
but this is for example
the number is the width of your screen
What does the Message widget do?
?
jesus christ
ohhhhh
what 😂
its like a multi-line label
that automaticly goes on the next line
yeah
exactly what i've been looking for
cool
any chance you know how to scroll trought one?
if its THAT big
I was tkinking you mean check if the label is bigger than the screen
any chance you know how to scroll trought one?
@digital rose ? scroll the text
yes
im looking at stackoverflow rn
ah
sec
hmmm
I don't sure
Hi, I am updating my app which was made with QT5 Designer and want the QLineEdits to expand to the size of its contents. How can I do this. Thanks, Famous8
hi
hi
sorry I don't know in this @eternal apex
what is you'r problem @unique forge
QLineEdits
yes
is this module?
oh
sorry
QT5 is not a module
@eager beacon Hi, I am updating my app which was made with QT5 Designer and want the QLineEdits to expand to the size of its contents. How can I do this. Thanks, Famous8
ah
so I'm not good in QT5 Designer
i'm really sorry
I use tkinter for Designer like:
import tkinter
root = Tk()
Button(root,text="Click Me").place(x=10,y=20,width=10,height=40)
root.mainloop()
ah
and after creating the UI with drag and drop you program all the widgets
yeah
with Tkinter you program everything
but I prefer the tkinter system
which I find a bit tedious
yeah
what are layouts
@unique forge it basically is a predefined way of how your widgets are arranged dynamically
it should work for the situation your in if i understand correctly
because when I press a button it prints text in a QLineEdit
in QT designer you right click on your frames and widgets and click layout vertically
but sometimes the number is really long
or any of the options
wait you want to expand the size of the Qlineedit?>
only
?
then I am not sure whether this will be as helpful what you need to do this check if the lineedit's value is greater than a certain value and then if it is increase the widget of the lineedit
this should work for what your trying to do ^
yes
if i wanted to make a simple UI for a program im writing (just needs buttons, tables, and ability to show image) what would be the best way?
hi
@hollow needle
you can use Tkinter, or PyQT5, which has a software called QT Designer, which is a drag and drop interface, \but you still have to program the buttons later.
thanks!
you can use Tkinter, or PyQT5, which has a software called QT Designer, which is a drag and drop interface, \but you still have to program the buttons later.
@unique forge tkinter has one as well, its just not as user friendly
umm hold on, i dont remember off the top of my head
what is it called
@unique forge pygubu-designer
im trying to figure out something though if you have a minute... cant get a style to work, it just makes the border disappear
style.theme_create('chat',
settings={
'TLabelframe': {
'configure': {
'background': 'gray15',
'foreground': '#FFFFFF',
'borderwidth': '4',
'bordorcolor': '#1DA498',
'relief': 'flat'
}
},
'TLabelframe.Label': {
'configure': {
'background': 'gray15',
'foreground': '#FFFFFF',
'borderwidth': '4',
'bordorcolor': '#1DA498',
'relief': 'flat'
}
}
}
)
``` neither works and all of those are styles in the ttk.Style() class
its all good, maybe someone else will step in and answer. even without the border options, the border disapears and i dont understand why
tkinter isnt a built in in skinny versions of python, maybe thats the issue?
idk...
@digital rose idk either, but chances are that its missing from the python libraries. i dont have a clue about Linux though. its been ages since ive done anything on unix/linux
Time.sleep() is stopping the entire gui, including the event loop that shows the label. Then after 3 seconds it quits. You want to have something shown for x period of time and then close it?
does it matter if I use PyQt5 or PySide2 for an open-source app?
kinda disappointed, but thanks! You’ve always been helpful.
@digital rose tkinkter has an .after() timer. itll be better then time.sleep
if you need a time sleep you could thread it.
though tkinter as far as i know isn’t thread safe.
dont need it. root.after("time in ms", function) will wait x ms and then call the function
i made a frame in python, and put a button with an image on top of it. when i put my button into the frame the frame dissapears..
By the way, im using tkinter in python 3.8.5
Here is my code
from tkinter import *
from PIL import Image
def app():
window = Tk()
window.configure(bg="#FFFFFF")
window.resizable(False, False)
window.geometry("900x505")
window.title("Notes")
top_bar = Frame(window, height=48, width=900)
top_bar.configure(bg="#FAFAFA")
top_bar.pack(side=TOP)
# right click button code here
click_menu = Menu(window, tearoff=0, bd=0, activeborderwidth=0)
click_menu.configure(bg='#f1f1f1', bd=0, activebackground='#1CC88A', relief=SUNKEN)
click_menu.add_command(label="Delete Note")
click_menu.add_separator()
click_menu.add_command(label="Rename")
def right_click(event):
try:
click_menu.tk_popup(event.x_root, event.y_root)
finally:
click_menu.grab_release
window.bind('<Button-3>', right_click)
# top bar buttons code here
addbutton = PhotoImage(file="add.png")
create_new_button = Button(text="Button", image=addbutton)
create_new_button.configure(bd=0, bg="#fafafa", relief=FLAT)
create_new_button.pack(side=RIGHT)
# note list veiw code here
note_list = Listbox(width=900, height=457)
note_list.configure(borderwidth=0, highlightbackground='#ffffff')
note_list.configure(highlightthickness=0)
note_list.pack()
window.mainloop()
app()
someone pls help
@sinful wharf
create_new_button = Button(<master missing>, text="Button", image=addbutton)
same with your listbox. they have to be built in root elements. root/frame/labelframe/ect
@lunar kelp but when I do that the frame dissspears....
@lunar kelp but when I do that the frame dissspears....
@sinful wharf where are you placing it?
the frame is
side = TOP
the button is
side = RIGHT
And I'm placinf the button inside the frame
The frame is inside the window
@lunar kelp
@sinful wharf you dont have a side=Right that i see
...I do
oh your packing right... it still has to be in a master element... either in the frame or in window
what are you using for the parent?
its not in the code you gave earlier. its missing the parent... on top of that, give your button a height and a width... probably just filling the box. since you have an image, i cant actually run the code to fix it. but ive seen crazier things in tkinter
from tkinter import *
from PIL import Image
import time
def app():
window = Tk()
window.configure(bg="#FFFFFF")
window.resizable(False, False)
window.geometry("900x505")
window.title("Notes")
top_bar = Frame(window, height=48, width=900)
top_bar.configure(bg="#FAFAFA")
top_bar.pack(side=TOP)
# right click button code here
click_menu = Menu(window, tearoff=0, bd=0, activeborderwidth=0)
click_menu.configure(bg='#f1f1f1', bd=0, activebackground='#1CC88A', relief=SUNKEN)
click_menu.add_command(label="Delete Note")
click_menu.add_separator()
click_menu.add_command(label="Rename")
def right_click(event):
try:
click_menu.tk_popup(event.x_root, event.y_root)
finally:
click_menu.grab_release
window.bind('<Button-3>', right_click)
# top bar buttons code here
addbutton = PhotoImage(file="add.png")
create_new_button = Button(top_bar, text="Button", image=addbutton)
create_new_button.configure(bd=0, bg="#fafafa", relief=FLAT)
create_new_button.pack(side=RIGHT)
# note list veiw code here
note_list = Listbox(width=900, height=457)
note_list.configure(borderwidth=0, highlightbackground='#ffffff')
note_list.configure(highlightthickness=0)
note_list.pack()
def add_option(note_name, currtime):
note_list.add(note_name)
window.mainloop()
app()
you also need a parent for the listbox. and you height and width is greater then that of top_bar so it will cover the frame anyways. or not be fully displayed
just download this image and put it in the same directory if you really want to help me out thanks
btw rename this to whatever ive written in the code/edit the code or something
you also need a parent for the listbox. and you height and width is greater then that of top_bar so it will cover the frame anyways. or not be fully displayed
@lunar kelp oh shitttt almost forgot
what if my button is larger than the frame...
also why is hiehgt=47 not working on the button
height**
probably has to do with pack... i place everything, but you should really use grid over the other 2. i just havent used it yet. how my stuff is setup, i pack the parent element, and place everything else inside of it is how i think of it
@sinful wharf
from tkinter import *
from PIL import Image
import time
def app():
window = Tk()
window.configure(bg="#FFFFFF")
window.resizable(False, False)
window.geometry("900x505")
window.title("Notes")
top_bar = Frame(window, height=505, width=900)
top_bar.configure(bg="#FAFAFA")
top_bar.pack(side=TOP)
# right click button code here
click_menu = Menu(window, tearoff=0, bd=0, activeborderwidth=0)
click_menu.configure(bg='#f1f1f1', bd=0, activebackground='#1CC88A', relief=SUNKEN)
click_menu.add_command(label="Delete Note")
click_menu.add_separator()
click_menu.add_command(label="Rename")
def right_click(event):
try:
click_menu.tk_popup(event.x_root, event.y_root)
finally:
click_menu.grab_release
window.bind('<Button-3>', right_click)
# note list veiw code here
note_list = Listbox(top_bar, width=900, height=457)
note_list.configure(borderwidth=0, highlightbackground='#ffffff', background="black")
note_list.configure(highlightthickness=0)
note_list.place(x=0, y=0)
# top bar buttons code here
addbutton = PhotoImage(file="add.png")
create_new_button = Button(top_bar, text="Button", image=addbutton, width=50, height=50)
create_new_button.configure(bd=0, bg="#fafafa", relief=FLAT)
create_new_button.place(x=850, y=0)
def add_option(note_name, currtime):
note_list.add(note_name)
window.mainloop()
app()
``` is that what you wanted? i changed the background of the listbox to see where it was
@lunar kelp but the frames background color (#fafafa) isn't showing... That's what I wanted
its not going to if you have an element that fills it.
why do you want the frames bg to show? just change the Listboxs bg to #fafafa
I don't want the entire window to be that
I don't want the entire window to be that
@sinful wharf what exactly are you looking for? thats what im asking. you want the button in the frame, and the listbox being outside the frame?
Yesss
okay... so move the y on the code i gave you down 50 and itll show the frame color
- Button
- Frame for the button (top bar)
- Listbox
Button being inside the frame for the button, and the listbox being outside of the frame for the button, inside the window
from tkinter import *
from PIL import Image
import time
def app():
window = Tk()
window.configure(bg="#FFFFFF")
window.resizable(False, False)
window.geometry("900x505")
window.title("Notes")
top_bar = Frame(window, height=505, width=900)
top_bar.configure(bg="#FAFAFA")
top_bar.pack(side=TOP)
# right click button code here
click_menu = Menu(window, tearoff=0, bd=0, activeborderwidth=0)
click_menu.configure(bg='#f1f1f1', bd=0, activebackground='#1CC88A', relief=SUNKEN)
click_menu.add_command(label="Delete Note")
click_menu.add_separator()
click_menu.add_command(label="Rename")
def right_click(event):
try:
click_menu.tk_popup(event.x_root, event.y_root)
finally:
click_menu.grab_release
window.bind('<Button-3>', right_click)
# note list veiw code here
note_list = Listbox(top_bar, width=900, height=457)
note_list.configure(borderwidth=0, highlightbackground='#ffffff', background="black")
note_list.configure(highlightthickness=0)
note_list.place(x=0, y=50)
# top bar buttons code here
addbutton = PhotoImage(file="add.png")
create_new_button = Button(top_bar, text="Button", image=addbutton, width=50, height=50)
create_new_button.configure(bd=0, bg="#fafafa", relief=FLAT)
create_new_button.place(x=850, y=0)
def add_option(note_name, currtime):
note_list.add(note_name)
window.mainloop()
app()
run that code
Kk
btw im going for something like this
Can I somehow make the image button 2 pixels smaller
ya, thats what mine looks like, just change or remove background for the Listbox. set the other button image to x=10, y=0 or something similar will place the other button in that corner as well... adjust the x/y values accordingly
ya adjust the height/width variables
Has anyone used Pywebview or qt's webrendrer for a GUI?
Is it like a lighter version of electron for python?
hello I asked a question about user interfaces to #help-falafel, thanks
what is bin()?
{PyQt5} Hi, i wanna ask Is it mandatory to Call the setupUi method Of a Converted Ui file (PyUic) before accessing it's attributes?
def test():
root = Tk()
root.geometry('500x350')
root.configure(bg='#ffc917')
tweetText = Label(master=root,
text='',
font=('Verdana', 16),
foreground='#003082',
background='#ffc917')
tweetText.place(x=120, y=150)
mainloop()
with open('tweets', 'r+') as infile:
for bericht in infile:
tweetText['text'] = bericht
time.sleep(5)
nothing is displaying in my label text whys that?
gg
(I'm using tkinter with multiple files)
File welcomeScreen.py:
import tkinter as tk
import main
def WS():
window = tk.Frame(master=main.mainWindow, height=500, bg="#00ffa2")
welcomeText = tk.Label(master=window, text="Welcome!")
window.pack(fill=tk.BOTH)
File main.py:
#startup
import tkinter as tk
import welcomeScreen
mainWindow = tk.Tk()
mainWindow.title("DeHabit")
mainWindow.iconbitmap(r'media\pixil-frame-0 (3).ico')
#main
welcomeScreen.WS()
#runner
mainWindow.mainloop()
When i try to run the main file, it throws exception
Exception has occurred: AttributeError
partially initialized module 'welcomeScreen' has no attribute 'WS' (most likely due to a circular import)
you're importing welcomeScreen.py into main.py and then also importing main.py into welcomeScreen. That's definitely a circular import.
it has been fixed, ty!
@marsh perch sorry im late but try :
for bericht in infile: tweetText.config(text=bericht) time.sleep(5)
@marsh perch
okay thanks ill try that
Yeah sure
Hi, I want to update my current app created with PyQT5/ QT Designer One of the things I want to add is a setting where I can enlarge and decrease the font size of the text inside QLineEdits. How can I do this. Thanks, Famous8
