So I have an assignment in Computer Science that requires that I put an interactive menu into my python turtle graphics projects. I run on python 2.7.3 and would like some help on what modules to import and a basic outline of how to put an interactive menu into python turtle graphics. Thank you for your answers!
In 3.x, look at Lib/turtledemo/main.py for how to put a turtle canvas into a tkinter window with other stuff. In 2.x, the turtledemo main code is in Demo/turtle/turtleDemo.py in the source repository, but the Demo directory is not installed on Windows.
Related
Here is my problem. I developed a tkinter GUI for my project. However I am stuck with tkinter limitations. I developed python gui to create a virtual view for a red table as below. The window does not have any border or title. It is just put on the a picture background which is outside of the code.
However as you can see it is not lively enough for me. I want it to look like this:
Is there a way to do this in tkinter? I tried transparent backgrounds, however in Ubuntu transparent background with visible object is not possible. Also You cannot make different window shapes other than rectangle. What is your suggestions? Should I use another library. I really need an expert opinion about this.
Transparent background reference
Different window shape other than rectangle
My environment : Ubuntu 16.04 Python 3.5.2
You can't specifically change the shape of a Tkinter Window, but you can create a canvas and design your own shape (then add your buttons and labels on this canvas if needed).
You can also take a look at PyQt or Kivy, but if you are confortable with Tkinter go with Canvas.
So to solve my issue I found a python library wxPython:
You can check this link it creates Wx non rectangular shape
It creates the the window using inheritence. I tried selected answer and It solved my question.
Btw I tried QTPython, Kivy, tkinter. Non of them had straight example such wxPython.
I am trying to combine tkinter and pyglet into one application. Using tkinter for the gui, one component of which is a canvas and I would like to use pyglet to paint/draw on that canvas. Is this possible? Examples I found show two separate windows. That's not what I'm looking for.
Hello I need to make a app, with a icon in systray for Windows. I use Python3 with wxPython Phoenix.
I found code example like:
example 1
or
example 2
or
exemple 3
But is out-dated (or for Python2.x), now wxPython use wx.adv for icon in taskbar, and I have trouble with the doc for WxPython Phoenix. Could someone help me and give me tips or a easily understandable example
This answer works just need to remove ")" after : on the end of def.
answer
def on_left_down(self, event):)
print ('Tray icon was left-clicked.')
Is it possible to get screenshot of certain window and not the entire computer screen?
My window is written with QtDesigner using main window template.The window is use to display results of calculations. How can I take a screenshot of just the one window? Is pyscreenshot able to do this?
I understand that I can do part of the screen using bbox, but if the user moves the window, it won't take the screenshot correctly.
I'm currently using pyscreenshot and it takes a screenshot of entire screen.
I've found a solution based off other posts.
Found in: Python Screenshot of inactive window PrintWindow + win32gui
To solve issue with importing modules, I downloaded pywin32 for python and use these as my imports
import win32gui
import win32ui
from ctypes import windll
from PIL import Image
Using Windows 10 64bit
I'm trying to learn how to code in python and I decided to make my first program a simple bot for a game.
The game is a downloadable game.
The goal is for my mouse to click a button at coordinates (200, 200)
I have tried many different ways to get this to work.
I've tried...
PyAutoGui
pywin32
ctypes
PyAutoGui implementation
pyautogui.click(200, 200)
pywin32 implementation
import win32api, win32con
def click(x,y):
win32api.SetCursorPos((x,y))
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
click(10,10)
Any ideas? From what I understand I need to use a low level driver?
I just don't understand how to emulate it as if a real mouse was clicking
try pyautogui.mouseDown() or pyautogui.mouseUp() instead...
info: https://automatetheboringstuff.com/chapter18/
Make sure, that you set the raw input checkbox in game settings for the mouse. I had the same issue with CSGO
Not sure if this will work with your game but you can use PyUserInput.